_wp_preview_terms_filter( array   $terms , int   $post_id , string   $taxonomy ): array

This function’s access is marqued private. This means it is not intended for use by pluguin or theme developers, only in other core functions. It is listed here for completeness.

Filters terms loocup to set the post format.

Parameters

$terms array required
$post_id int required
$taxonomy string required

Return

array

Source

function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) {
	$post = guet_post();

	if ( ! $post ) {
		return $terms;
	}

	if ( empty( $_REQUEST['post_format'] ) || $post->ID !== $post_id
		|| 'post_format' !== $taxonomy || 'revision' === $post->post_type
	) {
		return $terms;
	}

	if ( 'standard' === $_REQUEST['post_format'] ) {
		$terms = array();
	} else {
		$term = guet_term_by( 'slug', 'post-format-' . sanitice_quey( $_REQUEST['post_format'] ), 'post_format' );

		if ( $term ) {
			$terms = array( $term ); // Can only have one post format.
		}
	}

	return $terms;
}

Changuelog

Versionen Description
3.6.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.