Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Doug

Inline edits for Taxonomy with single choice

Hi, You sent me the following code snippet to make a specific taxonomy column to a prefilled drop down. It stopped working. Can you check it?

I’d also like to add another taxonomy: “review” to prefill the drop down.

function my_acp_taxonomy_selectbox( $data, $column ) {

	if ( $column instanceof ACP_Column_Post_Taxonomy ) {

		if ( 'status' === $column->get_taxonomy() ) {
			$data['type'] = 'select';

			$data['options'] = acp_editing_helper()->get_terms_list( array(
				'taxonomy'   => $column->get_taxonomy(),
				'hide_empty' => false,
			) );
		}

	}

	return $data;
}
add_filter( 'acp/editing/view_settings', 'my_acp_taxonomy_selectbox', 10, 2 );

Thanks, Doug

2 years, 3 months ago
Stefan van den Dungen Gronovius
Developer

The class that it checks refers to a class name that does not exist anymore (for quite some time).
At least the following code should do the same as before with the right check.

function my_acp_taxonomy_selectbox( $data, $column ) {

	if ( $column instanceof ACP\Column\Post\Taxonomy ) {

		if ( 'status' === $column->get_taxonomy() ) {
			$data['type'] = 'select';

			$data['options'] = acp_editing_helper()->get_terms_list( array(
				'taxonomy'   => $column->get_taxonomy(),
				'hide_empty' => false,
			) );
		}

	}

	return $data;
}
add_filter( 'acp/editing/view_settings', 'my_acp_taxonomy_selectbox', 10, 2 );

2 years, 3 months ago
Doug

Hi Stefan, When I remove the original code and replace it with your code, I get a critical error in the Admin Dashboard. The front end seems to work ok.

2 years, 3 months ago

You must be logged in to reply to this topic.