Featured Posts

Mark blog posts as featured from the editor, filter them in the Posts list, and query featured posts with WP_Query, tax_query, meta queries or the REST API.

Free 1 min read Updated
On this page

Elephanta adds a simple Featured flag to blog posts that you can use in Elementor loops, the Ajax Search widget and your own queries.

#Mark a post as featured

Open any post and use the Featured Post panel in the editor sidebar. The Posts list gets a Featured column, where featured posts show a gold star, and a dropdown above the list to show featured or non-featured posts.

#How it is stored

Featured status is stored in the public elephanta_feature taxonomy with the term featured. It is kept in sync with the boolean post meta _elephanta_featured_post for integrations that use meta queries.

Taxonomy query (recommended):

$featured_posts = new WP_Query( array(
    'post_type'         => 'post',
    'elephanta_feature' => 'featured',
) );

Generic tax_query:

$query_args = array(
    'post_type' => 'post',
    'tax_query' => array(
        array(
            'taxonomy' => 'elephanta_feature',
            'field'    => 'slug',
            'terms'    => array( 'featured' ),
        ),
    ),
);

Custom field query: query _elephanta_featured_post with the value 1.

REST API: resolve the term ID from /wp-json/wp/v2/elephanta-features?slug=featured, then filter /wp-json/wp/v2/posts?elephanta-features=TERM_ID.

In Elementor

Use the taxonomy Featured in an Elementor Loop Grid or Posts widget query, or the Featured filter in the Ajax Search widget.