WordPress does not provide native sticky posts for custom post types. Core sticky behavior applies only to the built-in post type and places selected posts at the top of the posts front page. To feature items in a custom post type archive, create a separate feature flag (usually post metadata) and change that archive’s ordering—or render a separate featured block above the normal results.
What “sticky” means in WordPress
In core WordPress, a sticky post is a regular post selected for priority display on the front page of posts. The Theme Handbook states: “This feature is only available for the built-in post type post and not for custom post types.” The sticky_posts option and related query arguments therefore should not be treated as a general-purpose list for custom post types.
A custom post type can still have the same reader experience, but the state must be yours to define. Use a field such as _is_featured, a publication-status taxonomy, or another value already used by the site. Store and edit that flag through your plugin or theme rather than trying to add the custom post IDs to WordPress’s native sticky option.
Choose how the archive should feature items
| Design | How it works | Pagination and maintenance | Best fit |
|---|---|---|---|
| Unified archive ordering | The existing archive query sorts flagged items first, then applies the normal secondary order such as date. | One loop and the archive’s normal page counts; the main query must be changed before it runs. | The archive should remain one continuous list. |
| Separate featured section | A dedicated query displays flagged items above the ordinary archive loop. | You must exclude featured IDs from the regular query and decide whether featured items count toward the archive page size. | The design calls for a visually distinct “Featured” area. |
Option 1: Put featured items first in the archive’s main query
1. Identify the archive and template
If the registered post-type key is book, WordPress looks for archive-book.php. Replace book with the actual key. A shared archive template can also branch with is_post_type_archive(). Registering a post type does not automatically mean every custom query or template will behave as intended, so confirm that the post type has an archive and that its rewrite settings are correct.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →2. Add an explicit feature flag
Give editors a controlled way to mark an item featured. A checkbox in a metabox, a field supplied by an existing content plugin, or a taxonomy term can work. Keep the value consistent—for example, numeric 1 for featured and 0 or no value for ordinary items. The field name and data type should match the code used by your site.
3. Alter only the intended front-end query
pre_get_posts runs before a query executes, so it can adjust the archive’s existing main query without creating a second loop. Guard the callback against administration screens, secondary queries, and other post types.
add_action( 'pre_get_posts', function ( $query ) {
if ( is_admin() || ! $query->is_main_query() ) {
return;
}
if ( ! $query->is_post_type_archive( 'book' ) ) {
return;
}
// Adapt the field name, data type and ordering to your site.
$query->set( 'meta_key', '_is_featured' );
$query->set( 'orderby', array(
'meta_value_num' => 'DESC',
'date' => 'DESC',
) );
} );
This is an implementation pattern, not a universal drop-in. Test it against the WordPress version, existing ordering, and how your field stores false or missing values. If the archive already has a custom orderby, pagination setting, or another callback, merge the rules rather than silently replacing them. Decide what should happen to items without the metadata and verify that they still appear.
#1 Best Overall
4. Keep the secondary order deliberate
Featured status should normally be the first sort key, with date, title, or another business rule as the tie-breaker. Without a secondary order, the order of equally flagged items may be unpredictable. Preserve the archive’s intended page size and let WordPress calculate its normal pagination.
Option 2: Render a separate featured block
Query featured IDs for the same post type
Use a new WP_Query when the featured items need their own heading, card design, or placement above the archive. Constrain that query to the custom post type and your feature field, and limit the number of cards shown.
$featured = new WP_Query( array(
'post_type' => 'book',
'posts_per_page' => 3,
'meta_key' => '_is_featured',
'meta_value' => '1',
'orderby' => 'date',
'order' => 'DESC',
) );
Adapt the arguments to your storage model and existing archive rules. A taxonomy-based flag, for example, should use a taxonomy query instead of a metadata query.
Prevent duplicates in the regular loop
Collect the IDs displayed in the featured loop and exclude them from the ordinary archive query with post__not_in. Apply that exclusion on every archive page, not only page one. Otherwise a featured item can appear again in the regular list or move unpredictably as visitors paginate.
Rank #3
Make an explicit page-size decision
There are two valid policies: featured cards can be additional content that does not consume the archive page size, or they can count toward the page’s total number of entries. The first is simpler for readers but may show more items than the configured page size; the second requires coordinated limits and careful handling of later pages. Document the choice in the template and test page one, page two, an empty featured set, and fewer featured items than the limit.
Quick Recap
Best Value
Rank #4
Pagination traps to avoid
- Do not add an arbitrary offset. WordPress documents that
offsetcan break pagination unless you manually adjust totals and page calculations. - Do not assume
pagedis always the right variable. Ordinary archives generally usepaged; a static front-page template can require thepagequery variable. Confirm the template context before copying pagination code. - Check empty and boundary states. Test no featured items, exactly one page of results, a featured item near the page boundary, deleted or unpublished featured entries, and later archive pages.
- Preserve query counts. A main-query solution lets WordPress calculate totals normally. Separate loops need a deliberate decision about which entries are removed and how many remain on each page.
Debugging checklist
- Confirm the registered post-type key and visit its archive URL.
- Verify that the archive template is named
archive-{post_type}.phpor that the shared template’s conditional matches the post type. - Check that the feature field is saved on the intended items and uses the value your query expects.
- Ensure the ordering callback runs only on the front-end main archive query.
- Inspect the generated query or temporarily log the query variables in a development environment.
- Test pagination, duplicate suppression, drafts, scheduled posts, and items whose feature flag is missing.
Which approach should you use?
Use the main-query approach when “featured first” is simply the archive’s ordering rule and you want one consistent result set. Use a separate featured section when the promoted items need different markup, a heading, or a fixed number of cards. In both cases, the reliable pattern is the same: define a custom feature state, scope the query change to the intended archive, retain a deterministic secondary order, and test pagination instead of relying on native sticky-post settings.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

