I have a wordpress plugin that is interfering with the function of another plugin. But, I believe the interference only occurs on the admin side.
I’ve found the lines within the code that are interfering, and they appear to be loading html code on the header and footer of ALL admin pages.
I would like to restrict these lines of code so that they only display on the post/page edit pages of the admin.
Not exactly sure how to do that. I know I’ll need some sort of conditional statement, but not sure EXACTLY how the code should read or what the best condition would be to use.
Any help would be greatly appreciated.
Using @One Trick Pony’s method, this should do what you want:
If you want it on the add OR edit screens, then:
After trying cale_b’s suggestion and finding that his code would only work if admin_init and admin_head had already loaded (but that’s the very code I was trying to conditionally load), I needed to go another way.
Thanks to Cale_b for giving me a little head-start from which I was able to come up with the following conditional. Also, apologies to Cale_b for not providing him enough info to know that his code would not work.
The working code was this:
This allowed me to only “run” those add_action statements on the post edit and new post pages within the admin, eliminating the conflict with my other plugin.