Can i set load priority of wordpress plugins

Merge of two wordpress plugin and Create New but problem of priority.

Plugin_1 – That import product from Ebay

Read More

Plugin_2 – Automatic post product to social sites.

Problem Occur: Image not Come because of plugin_1 load take time that time plugin_2 post data social website.

So can i set priority ? I have also given plugin_2 save_post hook priority but not worked.

Loader.php As under

include_once(dirname(__FILE__) . '/Plugin_1.php');
register_activation_hook(__FILE__, array('Plugin_1', 'install'));
register_deactivation_hook(__FILE__, array('Plugin_1', 'uninstall'));  

include_once(dirname(__FILE__) . '/Plugin_2.php');
register_activation_hook( __FILE__, 'Plugin_2' );
register_deactivation_hook( __FILE__, 'Plugin_2' );

Suggest me if any way.

Thanks.

Related posts

Leave a Reply

2 comments

  1. Yes, you can set the priority using the add_action fucntion to register the plugin:

    add_action ( 'plugin_name', 'function_to_add', 10);
    

    where 10 is the priority, in a scale of 1 to 10.

  2. Late to the party but in case someone else is looking for this:

    Yes, add_action() is what you would use.

    The default value is 10, plugins will fire in ascending order, but it can be any integer (unsure how negative integers function).

    Just know that PHP will fire in order as expected. If the real functionality of your plugin is JavaScript functionality that is loaded in with PHP, those features will not be asynchronous inherently, so (obviously) you can’t perfectly rely on add_action() to perform JavaScript functions “in order” if any of them are asynchronous.

    Here’s the documentation for add_action