Linux 软件免费装
Banner图

Sticky CPT

开发者 whodunitagency
leprincenoir
更新时间 2026年9月30日 20:27
PHP版本: 8.2 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

forward cpt sticky push highlighting

下载

1.0.0 1.0.1 2.0.0 3.0.0

详情介绍:

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; }

安装:

  1. Upload the plugin files to the /wp-content/plugins/sticky-cpt directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the 'Plugins' screen in WordPress

屏幕截图:

  • list items with Sticky

升级注意事项:

3.0.0 Requires WordPress 6.6 and PHP 8.2. The sticky_value_cpt post meta is removed: use is_sticky() instead.

常见问题:

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.

How are sticky contents synchronized between Polylang translations?

Enable "Sticky posts" in the Polylang synchronization settings. Until 2.0.0 the sticky state was carried by a custom field, so it followed the "Custom fields" synchronization. Since 3.0.0 it only follows the "Sticky posts" synchronization.

Known issue with Polylang: a bulk edit unsticks translated contents

When the Polylang "Sticky posts" synchronization is enabled, a bulk edit that leaves the "Sticky" field on "No Change" unsticks the edited contents and their translations. This comes from Polylang (observed with Polylang 3.8.10) and also affects regular posts, with or without this plugin. Until it is fixed in Polylang, select "Sticky" explicitly in the bulk edit form when all the selected contents are sticky, or stick them again afterwards.

更新日志:

3.0.0 2.0.0 1.0.1 1.0.0