Additionally added URL params leading to “Invalid post type.” in the Admin Panel

wordpress.stackexchange https://wordpress.stackexchange.com/questions/385825

  •  26-04-2021
  •  | 
  •  

Question

I've a bug that I cannot reproduce on my local/staging evn and occurs only on prod(having the same code, db and files). Here is what I get when visiting all of the default post types/taxonomies or custom created by me or plugins(it's not bugged on settings pages for ex):

When visiting /wp-admin/edit.php?post_type=page the page loads as it should, immediately after it load the URL changes to

/wp-admin/edit.php?post_type=page%3Fpost_type%3Dpage

therefore any further action in this window will lead to Invalid post type. Updating the core and all of the plugins, or removing all of them didn't fixes the issue. Couldn't find anything related in the debug.log. Only when I disable my browser JS it's working fine, but I don't load any custom script to the wp admin.

I'll really appreciate if someone can give a hint, thanks in advance.

Was it helpful?

Solution 2

Posting the solution I've found for my problem.

It appears that we have mod_security on our prod env, and recommended clause is to replace "server info" and on what the site is hosted on(for security reasons).

In my case it was replaced with IIS 6, and that tricked the WordPress installation as well, which on it's end is doing additional URL optimizations...

OTHER TIPS

What you can do is copy live DB, and deploy it to dev. Once you do that, start to disabling plugins one by one to see which one causes an error. If it doesn't help - check where else you have code injections ( theme or drop-in or must use plugins). If it doesn't help you need to perform the same actions on live (which isn't better solution). I would suggest to open (with js disabled page "/wp-admin/edit.php?post_type=page" and see what js file and code included - from which plugins, this will be a massive hint where to search next.)

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top