Skip Navigation

[Resolved] WP Admin menu items not sorting as configured

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Waqar 1 year, 10 months ago.

Assisted by: Waqar.

Author
Posts
#2618063

I am trying to:
When I create a Custom Post type, I can set where it appears in the left hand WP admin menu. This was working fine after creating a few post types a couple weeks ago. Now that I added a few more post types, the ordering is not working at all. In fact I seem to have no control since they just appear in the same spot no matter how much I edit the desired order within each post type.

Link to a page where the issue can be seen: Attached image shows the custom posts types of Quotes, Books, Guests, Podcasts, Essays, FAQs

I expected to see: The items ordered on the left based on how I set it up in each post type config page. I have them set up to order as Podcasts, Guests, Essays, Books, Quotes, FAQs

Instead, I got: Not ordered as I set them.

#2618249

Hi,

Thank you for contacting us and I'd be happy to assist.

I couldn't find any image attached to the ticket. Can you please share temporary admin login details, so that I can see how these post types are configured in the admin area?

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

regards,
Waqar

#2618449
screencapture-degreen-wp-admin-admin-php-2023-06-23-17_04_48.png
Screenshot from 2023-06-22 12-03-21.png

Sorry, here's the screenshot I meant to send earlier, plus a full page image showing how the Podcast type is configured, and that I want it to appear after Posts in the left side menu.

#2619047

Thank you for sharing the screenshots.

To have absolute control over the admin menu position of the custom post types, you can make use of the 'menu_position' argument.

For example, to move the 'Podcasts' post type menu item, immediately after 'Posts' you can assign it the menu position of '6':


add_filter('register_post_type_args', 'podcast_position_custom', 10, 2);
function podcast_position_custom($args, $post_type){
	// if post type 'podcast'
	if ($post_type == 'podcasts'){
		$args['menu_position'] = 6;
	}
	return $args;
}

The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through the active theme's "functions.php" file.

Similarly, you can include code snippets for the other custom post types too.

Useful links:
https://developer.wordpress.org/reference/hooks/register_post_type_args/
hidden link