Menu position not always working?
-
Hi there,
I noticed that the menu order seems not to work when I have more CPTs and I do not get my head around it.
No matter what I try, that’s what I get.
Posts
MyCPT1
MyCPT2
MyCPT3
MyCPT4
Media
MyCPT5
MyCPT6
PagesAny idea what I could do there?
-
Best I can offer at the moment is the listing at https://developer.ww.wp.xz.cn/reference/functions/register_post_type/#menu_position where it shows the default positions for various other menu items and could give an idea of values to use to better position.
I also think if multiple items specify the same position value, there can be a clash and one doesn’t get shown at all.
Thanks Michael, I am aware about that post … I thought about the same when using several CPTs.
I tried to apply different menu positions to the individual CPTs
attempt 1: give all of them position 5
attempt 2: give all of them position 6
attempt 3: give them position 5 to 9
attempt 4: give them positions with decimal 5.1, 5.2, 5.3, 5.4Nothing worked unfortunately, and I have no idea why.
There are some white label plugins or wp cusomize admin plugins that allow to move the items around as well. With them it does work, but I am not installing a plugin just for that. Actually it should work with the menu position, but it seems there are some limitations.
As far as i’m aware, you’d want them to have whole numbers and sequential. Giving the same number for each would override the positions.
I can try some things out and tinker if you provide the blob of JSON data in the tools section. Just let me know what the desired order is, so I can see if I can achieve that.
Hey again,
sure – find it here to give it a shot
https://pastebin.com/PX2BnkHxI read somewhere about the decimal so I thought I give it a try. Anyway, all other approaches did not work either. As shown in my initial posts only the first four CPTs are above Media.
Cheers
MarkusNot finding anything obvious thus far, and I’m ending up digging into the WP admin files for how/when the menus are being sorted etc. Will try a bit more later.
Thanks for keeping me up to date … it’s strange, even though this is new to me but I assume that your plugin basically works with default WordPress functions. So perhaps the issue goes beyond the capabilities of the plugin.
Then on the other hand, I know that there are plugins where you can just drag and drop and rename pretty much everything in WP admin and those work and allow to reorder to everyones liking… so somehow it must be possible.
Yeah, we just pass the saved value through to WordPress core and let it handle the rest themselves.
I’m definitely not against the idea of using other plugins that further customize the admin menu, especially if it gets the results you’re wanting. No reason why we can’t use both CPTUI and those.
Sure … just sometimes of course we try to avoid plugins for every tiny thing. It’s not an urgent issue, as you can imagine. If you ever get to it and find a solution, please let me know … if I get deeper into code and figure something out, I’ll get back here
Just wanted to check in quick with this one @markussss and see how things went on your end.
Hi Michael, I have no idea and didn’t figure it out. Needed to accept that the sorting/order does not work how I (everyone?) expected it.
Very odd and I still suspect internal things going on more than what we’re doing with the plugin, since all we need to do is pass in the specified value, as per the documentation, which I believe we do.
Hopefully someone with more insight may stop by this thread sometime?
Yes, could be core related … I can’t invest more time either in it, as nobody is even requesting it. I just tried to have a better organized admin menu without additional plugins.
Maybe someone else will contribute later…
The topic ‘Menu position not always working?’ is closed to new replies.