开发者

Preventing 3rd party plugin from running based on my plugin

开发者 https://www.devze.com 2023-02-27 04:31 出处:网络
I\'ve been struggling with this for hours.I have a 3rd party plugin that is designed to send a tweet to Twitter with every post addition.I have my own plugin that simply creates a post.I have to be ab

I've been struggling with this for hours. I have a 3rd party plugin that is designed to send a tweet to Twitter with every post addition. I have my own plugin that simply creates a post. I have to be able to prevent the 3rd party plugin from sending to Twitter based on a checkbox I have in my plugin.

I looked at the 3rd party plugin code and being a newbie, I'm not sure the best way to go about this. Nothing has w开发者_运维百科orked for me so far. But what I think is going on, is that they added a hook to 'publish_post' to run a function, and it gets kicked off before I have the chance to do any prevention. I tried to run a "remove_action" from within my own "add_action" hook on 'publish_post' based on the checkbox value, but the tweet still occurs. I even set my add_action with a priority of 10 and theirs at 12.

Am I missing something in the sequence of events? Again, I'm a newbie to WP, so any help would be greatly appreciated.


The only way I could figure this out, was to set the 'publish_post' to 1 minute into the future. This gave me enough time to set a post metadata property for the 3rd party plugin, which it built to flag whether it has been tweeted or not. I am essentially faking it out.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号