Linux 软件免费装
Banner图

Astro Hide Unpublished Post Types From Menu

开发者 alian
更新时间 2026年11月18日 19:47
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

menu menus hide post types unpublished

下载

1.0.1 1.0.0 1.0.2 1.0.3 1.0.4 2.0.0

详情介绍:

The "Astro Hide Unpublished Post Types From Menu" plugin automatically hides from WordPress navigation menus the items that point to content with a status other than "published": draft, pending, scheduled and private posts, pages and custom post types such as WooCommerce products. This prevents visitors from reaching "page not found" (404) errors and saves the site administrator from updating the menus every time a page is unpublished. When a hidden item has published sub-items, they move up to the nearest visible level, so they stay reachable. Custom links, category and archive items are never hidden. The plugin works with classic menus (Appearance > Menus and the Navigation Menu widget). The Navigation block of block themes already hides unpublished pages on its own.

安装:

  1. Upload the astro-hide-unpublished-post-types-from-menu folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the 'Plugins' menu in WordPress.
  3. Unpublished content is hidden from the navigation menus automatically: there are no settings.

升级注意事项:

2.0.0 The plugin now really hides unpublished content from navigation menus and no longer filters the admin lists for non-administrators. Check your menus after updating.

常见问题:

Can I customize which items are hidden?

Yes, with the astro_hupt_is_item_hidden filter. It receives true when the item points to unpublished content, and the menu item. For example, to keep private pages in the menu for logged-in users: add_filter( 'astro_hupt_is_item_hidden', function ( $hidden, $item ) { return $hidden && ! ( is_user_logged_in() && 'private' === get_post_status( $item->object_id ) ); }, 10, 2 );

Does the plugin change the admin lists?

Not anymore. Up to version 1.0.4 it hid unpublished content from the admin lists for users other than administrators, which did not hide anything from the menus and prevented authors and editors from seeing their drafts and the posts awaiting review. Version 2.0.0 removed that behavior.

更新日志:

2.0.0 1.0.4 1.0.3 1.0.2 1.0.1 1.0.0