do_action and hook methods

Your analogy here is partially correct, but incomplete: I understand that when do_action is called wp looks for all registered listeners and invokes them according set priority. You need to consider what happens when you call add_action. WordPress never searches for the add_action statements, it has those in a list. When you call add_action, it … Read more

How to load wordpress environment without loading the template?

If you place the file in the WP root directory, e.g. http://mysite.com/myscript.php require( dirname(__FILE__) . ‘../blog/wp-load.php’ ); if (function_exists(‘wp_create_user’)) { echo “wp_create_user() found”; } If you are in a different directory, just make sure you are loading wp-load.php from the proper location.

Create a post variable processing page

You see a lot of code out there which includes wp-load.php or wp-blog-header.php to use the WordPress API within a php page loaded outside the context of WordPress. There’s often a better way to accomplish this. It’s also worth noting that any plugin which does that will get rejected from the WordPress.org plugin repository, with … Read more

Trying to avoid including wp-load.php

Add a rewrite endpoint to give your plugin a public URL- function wpa_my_endpoint(){ add_rewrite_endpoint( ‘my_api’, EP_ROOT ); } add_action( ‘init’, ‘wpa_my_endpoint’ ); After you flush rewrite rules, you’ll have the URL available for the scheduler to ping. http://example.com/my_api/do/something/ Then catch those requests on the parse_query action to invoke your plugin action: function wpa_parse_query( $query ){ … Read more