The emailer::send
is the function callback for a publish_post
action hook. This action hook accepts only one parameter which is the post ID and it is passed by WordPress.
When you define an action hook, you set what parameters are passed to the callback functions. For example:
$arg_1 = "The aregument value";
do_action( 'my_custom_action', $arg_1 );
Every time you hook into my_custom_action
, the $arg_1
value is passed to the function callback automatically.
add_action( 'my_custom_action', 'my_custom_action_callback' );
function my_custom_action_callback( $arg_1 ) {
//Do whatever
}
In the example you are talking about, the publish_post
action hook is is used. This action hook accept one argument, the post ID, and this argumente is passed to emailer:send
automatically by WordPress.
Related Posts:
- WordPress class, using add_action to call member function does not work
- Difference Between Filter and Action Hooks?
- How to create an API for my plugin?
- How to override existing plugin action with new action
- Which hook should be used to add an action containing a redirect?
- Plugin Form Submission Best Practice
- WordPress Update Plugin Hook/Action? Since 3.9
- PHP error with shortcode handler from a class
- Using a plugin class inside a template
- How to create a flexible abstraction for WP_Query?
- What is the correct way to build a widget using OOP
- Which action for triggering cron “wp”or “init”?
- How to make method from plugin available in theme?
- Using OOP plugin’s methods throughout the website
- Single Responsibility Principle and WP Classes
- add_action with a class method is causing fatal errors
- How do you use the plugin boilerplate loader class to hook actions and filters?
- add_filter OO with parameters
- How do I print a notice only on certain admin pages?
- Do I need to call do_action in my plugin?
- How Do I Load My Action Earlier Enough?
- How Can I Add a Filter to Class Instance Only?
- Which to use to execute code during the saving of a plugin settings page?
- Does WP fire delete_post when trashed posts are automatically deleted?
- What’s the earliest point I can get the queried object ID?
- The ideal place for storing persistent PHP objects
- How do I Make a Theme “plugin-ready”?
- A Post is saved twice or more during add_action(save_post)
- Plugin Architecture/Design Pattern – is better to use a private Observer/Mediator Pattern for plugin subclasses or WP add_action?
- Actions or filters fired when data is saved in a custom table
- In a plugin, why is add_action(‘init’) not executed before the plugin is activated?
- What’s the difference between hooks, filters and actions? [duplicate]
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- What action is called when drafts are saved?
- Is it possible to create an action hook using do_action() within add_action()?
- How can I hook into existing WordPress Bulk actions?
- When is it too late to call the action wp_enqueue_scripts?
- Odd behaviour with submenu link creation
- What is the Difference between directly call a function and call a function using add_action?
- How to add custom content under plugin row in WordPress admin plugin list?
- Using a front controller in a WordPress plugin, any suggestions?
- Define a function outside a class and call the function using action or filter hook
- Create a plugin to change the action to which a function is hooked
- set_sale_price in WooCommerce [closed]
- Modifying values with add_action to be sent to db
- Woocommerce – Hide a Column in Cart Table
- How to redirect to action on custom page within admin section
- WordPress Ajax callback function from plugin – OOP
- admin_notices not displaying in plugin
- Hook to get image filename when it is uploaded
- How do you render_callback for register_block_type to a method in another class?
- How to run an add_action hook for specific page
- Which action is triggered when a theme was modified?
- wp_transition_post_status does not change the status of the post
- Getting admin notices working for plugin errors
- Which are the hooks run before/after when a category’s deletion?
- Should action callbacks start with a verb?
- Execute Hook on the footer or header after activating a plugin
- How to Create database table when Plugin installed/activated, and delete database when Plugin deleted
- An echo line in a transition_post_status action leads to “cannot modify header information – headers already sent by”
- Namespaced action and filter tags
- Registering and using actions which return results in a Plugin class
- Issue plugin commands in admin settings page
- Advice on plugin structure
- My plugin class doesn’t work! [closed]
- Applying OO patterns and principles to plugin development
- Creating a shortcode, but getting tied up with OOP and Classes?
- add_action not calling back to function
- Tried in different ways but sidebar not working?
- conditionally load javascript & CSS for do_action() calls from plugin
- Plugin with action ‘save_post’ needs to press publish twice on order to publish
- Adding rewrite rule dynamically
- How to hook a custom user function to a wordpress core ajax action?
- Prefixing plugin hooks (actions/filters) with a wrapper class or functions
- Plugin Architecture Question: How to avoid using transients
- Unable to change footer using wp_footer action hook
- What is the proper method of using global $post?
- wp_set_object_terms not updating database without a die()
- How to filter content for specific content variable
- load_plugin_textdomain doestn’t work with add_action plugins_loaded
- Dynamically creating classes for Widget API
- Show error message after exception handled
- I have 2 plugins using the same wp_login action hook and one is not working
- Valid filenames for add_action’s first parameter
- Where do I put my add_action(… and add_filter(… and do I need to remove them?
- How dynamic action login_form_{action} is working
- What action hook can I use to add a JavaScript to a page post using a theme template that is not including get_header() nor get_footer()?
- How to get all queries’s results after they have executed?
- Bug: Post needs to be updated twice when adding action for save_post hook
- Delete data from database using row action
- When does save_post hook fire on post save/update
- Remove an action by extending class and replacing it
- Using OOP inside a Plugin – Is it allowed?
- WordPress plugin development OOP style
- Hook add_attachment error
- Call to undefined function is_home() or any conditional tags
- How to find list of all functions bind to a particular hook from my plugin?
- Can I Hook Into the TinyMCE Insert/Edit Link Button to Use Shortlink For Post?
- Include HTML (Bootstrap Modal Box) with a plugin into my header
- OOP plugin not working