Sticky CPT
The plugin allows to highlight the CPT in the same way as would the WordPress core functionality for posts. You can highlight new content created for your CPT. It is also possible to highlight the content quickly thanks to quick edit and bulk actions. The sticky checkbox is available in the block ed
The plugin allows to highlight the CPT in the same way as would the WordPress core functionality for posts. You can highlight new content created for your CPT. It is also possible to highlight the content quickly thanks to quick edit and bulk actions.
The sticky checkbox is available in the block editor, in the classic editor, in quick edit and in bulk edit, for every public custom post type. Sticky items are stored in the core sticky_posts option, exactly like sticky posts: is_sticky() works out of the box.
Start example
$args = array( 'post_type' => ['project'], 'post_status' => 'publish', 'posts_per_page' => -1, 'post__in' => get_option( 'sticky_posts' ) ); $stickyProject = new WP_Query( $args );
Hook available
add_filter( 'sticky_cpt_add_cpt' , 'add_cpt' ); function add_cpt( $post_types ) { $post_types['newcpt'] = 'newcpt'; return $post_types; }
Screenshots & previews.
- 01Upload the plugin files to the /wp-content/plugins/sticky-cpt directory, or install the plugin through the WordPress plugins screen directly.
- 02Activate the plugin through the ‘Plugins’ screen in WordPress
Frequently asked questions.
Does my custom post type need the `custom-fields` support?
No. Since 3.0.0 the block editor uses the native sticky field of the REST API. Your custom post type only needs show_in_rest to use the block editor.
Who can stick a content?
Users who can both publish and edit others’ contents of the custom post type, the same rule WordPress applies to posts.
I was reading the `sticky_value_cpt` post meta, what should I do?
This meta was removed in 3.0.0. Use is_sticky( $post_id ) or get_option( 'sticky_posts' ) instead.