admin管理员组文章数量:1279175
An extension of this question in a way.
My Wordpress dashboard menu looks like below:
Array
(
[2] => Array
(
[0] => Dashboard
[1] => read
[2] => index.php
[3] =>
[4] => menu-top menu-top-first menu-icon-dashboard
[5] => menu-dashboard
[6] => dashicons-dashboard
)
[4] => Array
(
[0] =>
[1] => read
[2] => separator1
[3] =>
[4] => wp-menu-separator
)
[10] => Array
(
[0] => Media
[1] => upload_files
[2] => upload.php
[3] =>
[4] => menu-top menu-icon-media
[5] => menu-media
[6] => dashicons-admin-media
)
[15] => Array
(
[0] => Links
[1] => manage_links
[2] => edit-tags.php?taxonomy=link_category
[3] =>
[4] => menu-top menu-icon-links
[5] => menu-links
[6] => dashicons-admin-links
)
[25] => Array
(
[0] => Comments <span class="awaiting-mod count-0"><span class="pending-count" aria-hidden="true">0</span><span class="comments-in-moderation-text screen-reader-text">0 Comments in moderation</span></span>
[1] => edit_posts
[2] => edit-comments.php
[3] =>
[4] => menu-top menu-icon-comments
[5] => menu-comments
[6] => dashicons-admin-comments
)
[5] => Array
(
[0] => Posts
[1] => edit_posts
[2] => edit.php
[3] =>
[4] => menu-top menu-icon-post open-if-no-js
[5] => menu-posts
[6] => dashicons-admin-post
)
[20] => Array
(
[0] => Pages
[1] => edit_pages
[2] => edit.php?post_type=page
[3] =>
[4] => menu-top menu-icon-page
[5] => menu-pages
[6] => dashicons-admin-page
)
[26] => Array
(
[0] => Templates
[1] => edit_posts
[2] => edit.php?post_type=elementor_library
[3] =>
[4] => menu-top menu-icon-elementor_library
[5] => menu-posts-elementor_library
[6] => dashicons-admin-page
)
[27] => Array
(
[0] => Donations
[1] => edit_give_forms
[2] => edit.php?post_type=give_forms
[3] =>
[4] => menu-top menu-icon-give_forms
[5] => menu-posts-give_forms
[6] => dashicons-give
)
[6] => Array
(
[0] => WP Links Page
[1] => manage_options
[2] => edit.php?post_type=wplp_link
[3] =>
[4] => menu-top menu-icon-wplp_link
[5] => menu-posts-wplp_link
[6] => dashicons-admin-links
)
[59] => Array
(
[0] =>
[1] => read
[2] => separator2
[3] =>
[4] => wp-menu-separator
)
[60] => Array
(
[0] => Appearance
[1] => switch_themes
[2] => themes.php
[3] =>
[4] => menu-top menu-icon-appearance
[5] => menu-appearance
[6] => dashicons-admin-appearance
)
[65] => Array
(
[0] => Plugins <span class="update-plugins count-4"><span class="plugin-count">4</span></span>
[1] => activate_plugins
[2] => plugins.php
[3] =>
[4] => menu-top menu-icon-plugins
[5] => menu-plugins
[6] => dashicons-admin-plugins
)
[70] => Array
(
[0] => Users
[1] => list_users
[2] => users.php
[3] =>
[4] => menu-top menu-icon-users
[5] => menu-users
[6] => dashicons-admin-users
)
[75] => Array
(
[0] => Tools
[1] => edit_posts
[2] => tools.php
[3] =>
[4] => menu-top menu-icon-tools
[5] => menu-tools
[6] => dashicons-admin-tools
)
[80] => Array
(
[0] => Settings
[1] => manage_options
[2] => options-general.php
[3] =>
[4] => menu-top menu-icon-settings
[5] => menu-settings
[6] => dashicons-admin-settings
)
[99] => Array
(
[0] =>
[1] => read
[2] => separator-last
[3] =>
[4] => wp-menu-separator
)
[30] => Array
(
[0] => Contact
[1] => wpcf7_read_contact_forms
[2] => wpcf7
[3] => Contact Form 7
[4] => menu-top toplevel_page_wpcf7
[5] => toplevel_page_wpcf7
[6] => dashicons-email
)
[100] => Array
(
[0] => Slider Revolution
[1] => manage_options
[2] => revslider
[3] => Slider Revolution
[4] => menu-top toplevel_page_revslider
[5] => toplevel_page_revslider
[6] => dashicons-update
)
What code can I put in theme's functions.php
to change entry #6 "WP Links Page" to always be below "Pages" (i.e. in the 20s range, according to this advice)?
Actual
Desired
An extension of this question in a way.
My Wordpress dashboard menu looks like below:
Array
(
[2] => Array
(
[0] => Dashboard
[1] => read
[2] => index.php
[3] =>
[4] => menu-top menu-top-first menu-icon-dashboard
[5] => menu-dashboard
[6] => dashicons-dashboard
)
[4] => Array
(
[0] =>
[1] => read
[2] => separator1
[3] =>
[4] => wp-menu-separator
)
[10] => Array
(
[0] => Media
[1] => upload_files
[2] => upload.php
[3] =>
[4] => menu-top menu-icon-media
[5] => menu-media
[6] => dashicons-admin-media
)
[15] => Array
(
[0] => Links
[1] => manage_links
[2] => edit-tags.php?taxonomy=link_category
[3] =>
[4] => menu-top menu-icon-links
[5] => menu-links
[6] => dashicons-admin-links
)
[25] => Array
(
[0] => Comments <span class="awaiting-mod count-0"><span class="pending-count" aria-hidden="true">0</span><span class="comments-in-moderation-text screen-reader-text">0 Comments in moderation</span></span>
[1] => edit_posts
[2] => edit-comments.php
[3] =>
[4] => menu-top menu-icon-comments
[5] => menu-comments
[6] => dashicons-admin-comments
)
[5] => Array
(
[0] => Posts
[1] => edit_posts
[2] => edit.php
[3] =>
[4] => menu-top menu-icon-post open-if-no-js
[5] => menu-posts
[6] => dashicons-admin-post
)
[20] => Array
(
[0] => Pages
[1] => edit_pages
[2] => edit.php?post_type=page
[3] =>
[4] => menu-top menu-icon-page
[5] => menu-pages
[6] => dashicons-admin-page
)
[26] => Array
(
[0] => Templates
[1] => edit_posts
[2] => edit.php?post_type=elementor_library
[3] =>
[4] => menu-top menu-icon-elementor_library
[5] => menu-posts-elementor_library
[6] => dashicons-admin-page
)
[27] => Array
(
[0] => Donations
[1] => edit_give_forms
[2] => edit.php?post_type=give_forms
[3] =>
[4] => menu-top menu-icon-give_forms
[5] => menu-posts-give_forms
[6] => dashicons-give
)
[6] => Array
(
[0] => WP Links Page
[1] => manage_options
[2] => edit.php?post_type=wplp_link
[3] =>
[4] => menu-top menu-icon-wplp_link
[5] => menu-posts-wplp_link
[6] => dashicons-admin-links
)
[59] => Array
(
[0] =>
[1] => read
[2] => separator2
[3] =>
[4] => wp-menu-separator
)
[60] => Array
(
[0] => Appearance
[1] => switch_themes
[2] => themes.php
[3] =>
[4] => menu-top menu-icon-appearance
[5] => menu-appearance
[6] => dashicons-admin-appearance
)
[65] => Array
(
[0] => Plugins <span class="update-plugins count-4"><span class="plugin-count">4</span></span>
[1] => activate_plugins
[2] => plugins.php
[3] =>
[4] => menu-top menu-icon-plugins
[5] => menu-plugins
[6] => dashicons-admin-plugins
)
[70] => Array
(
[0] => Users
[1] => list_users
[2] => users.php
[3] =>
[4] => menu-top menu-icon-users
[5] => menu-users
[6] => dashicons-admin-users
)
[75] => Array
(
[0] => Tools
[1] => edit_posts
[2] => tools.php
[3] =>
[4] => menu-top menu-icon-tools
[5] => menu-tools
[6] => dashicons-admin-tools
)
[80] => Array
(
[0] => Settings
[1] => manage_options
[2] => options-general.php
[3] =>
[4] => menu-top menu-icon-settings
[5] => menu-settings
[6] => dashicons-admin-settings
)
[99] => Array
(
[0] =>
[1] => read
[2] => separator-last
[3] =>
[4] => wp-menu-separator
)
[30] => Array
(
[0] => Contact
[1] => wpcf7_read_contact_forms
[2] => wpcf7
[3] => Contact Form 7
[4] => menu-top toplevel_page_wpcf7
[5] => toplevel_page_wpcf7
[6] => dashicons-email
)
[100] => Array
(
[0] => Slider Revolution
[1] => manage_options
[2] => revslider
[3] => Slider Revolution
[4] => menu-top toplevel_page_revslider
[5] => toplevel_page_revslider
[6] => dashicons-update
)
What code can I put in theme's functions.php
to change entry #6 "WP Links Page" to always be below "Pages" (i.e. in the 20s range, according to this advice)?
Actual
Desired
Share Improve this question asked Sep 25, 2021 at 5:21 algalgalgalg 1151 gold badge1 silver badge4 bronze badges1 Answer
Reset to default 1I could see "WP Links Page" is a custom post type, so if it's not registered by your own code, e.g. it's registered by a plugin (using register_post_type()
), then you can use the register_post_type_args
filter to change the menu_position
argument like so:
add_filter( 'register_post_type_args', 'my_override_register_post_type_args', 10, 2 );
function my_override_register_post_type_args( $args, $post_type ) {
// Move "WP Links Page" to below the "Pages". You could also try using 21 instead.
if ( 'wplp_link' === $post_type ) {
$args['menu_position'] = 20;
}
return $args;
}
本文标签: Changing menu order of a specific plugin in dashboard
版权声明:本文标题:Changing menu order of a specific plugin in dashboard 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741301384a2371106.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论