It’s never fired since the hook you need is not publish_post
but publish_magazine
which is actually {$new_status}_{$post_type}
hook. So try publish_magazine
update: also you don’t need to use get_post since you the hook passes the $post
object to the function as a second parameter. take a look at wp_transition_post_status()
and if that’s not working then you have something else going wrong.
Related Posts:
- What hook can I use to modify custom post data before it is displayed on the page?
- How to use template_include hook with form submission?
- Trying to add a page template for my custom post type from a plugin, but it will not display in the template dropdown unless file is in theme
- Adding custom meta boxes to specified custom post type
- How do I make reusable content blocks for header and footer when using WordPress headless with another front-end?
- posts from multiple post types in one slider
- New bulk action to resend welcome emails
- How do we update a custom file upload field with the Advanced Custom Field plugin?
- Custom Post Type – custom form in dashboard
- WooCommerce: after install hook
- $pages = get_pages(‘child_of=’.$post->ID); Why arguments are concatenated?
- How to remove a class function from a plugin by using remove_action()?
- Advanced WordPress plugin activation detection
- Trying to add_action in a loop
- how to execute some code after a post is published in WordPress [duplicate]
- How to remove products-links after the product title using remove_action
- Dequeue, Unregister, Remove Action – Not Working on Plugin
- Add action to custom Function
- Types plugin custom post add_action hooks
- Action on WordPress Install
- WP-API Custom Post Type json_no_route
- Price comparison table based on Custom Post Type?
- How can I list custom post type categories of portfolio
- Preview with Custom Post Type Not Working
- wp_ajax action responds with 0
- Show related posts based of current ACF field name in a single page post (a loop within loop)
- How can I store data from custom fields to custom tables?
- 2 wordpress site same database
- Custom CSS not being added by plugin
- Plugin generated unexpected output – No PHP errors
- Retrieve options set through a plugin
- How to Include Custom Post Content From Plugin
- Custom Template for wordpress cpt plugin
- “Allowed memory size” problem [closed]
- override function from my plugin [closed]
- Custom post type change excerpt more and excerpt length
- How to use add_action for multiple instances of the same class
- Use jQuery Datepicker code from plugin
- How to hook into action/filter call
- Order posts of a custom post type by the event date using FT Calendar Plugin
- Posts 2 Posts: Display custom types connected to the same other custom type but with another connection
- Creating teams of users in WordPress
- “After file loaded” action
- Custom Post Type template for homepage
- Running a function with args in add_action()
- hardcoded wp pages/plugins problems
- How to append new form elements in “Add New” form of Users in WordPress admin panel?
- Including content from legacy app: via plugin or custom content?
- How display specific category post to specific users?
- Dictionary-style definition list plugin
- I cannot include a file in my plugin settings page
- Custom Post Type, Custom Columns List
- Edit post image attributes on fly?
- How to create repeater field manually, without plugin (ACF Pro)?
- Error Metabox Warning: call_user_func() expects parameter 1 to be a valid callback
- Rename existing cpt and taxonomy with new textdomain
- how to create hierachial taxonomy and manage under single post type?
- Best method of implementing compartmentalized custom post types on a multi-site network
- Displaying page content from plugin, inside exising empty WP page
- Need to edit author permissions | custom taxonomy
- Import Recent Posts Only and Ignore old ones if exist
- Is it possible to pin a post in second position from top
- need click to clipboard button on my site
- Hook from plugin doesn’t fire up from external PHP script
- How to search post titles with whole words only, but not the exact word only?
- WordPress REST API: Query media files attached to a custom post type
- Save log for imports in WordPress database – options-table, custom post type or other place?
- Remove custom taxonomy name from the slug – Custom Post Type UI
- How to get the custom field value using SQL query
- Setting Author on CPT
- Check if theme supports sidebar
- How to display emails as a post?
- Custom Post Type same name as Category
- Create category for each user
- Error in Fetching Custom Post Type parent Category URL (slug)
- Adding category base to url in custom post giving 404?
- Register PODS Custom Field with WPGraphQL [closed]
- How to display the category name in the tab and post inside the tab in WordPress?
- Want to build parent-child relationships between custom post types created with CPT UI
- Hidden permalink different from displayed permalink
- custom post type plugin error [closed]
- Can i stream data to a custom_post_type?
- Is there a hook similar to “save_post” which only fires AFTER the post is completely published?
- update_option_{$option} not working (do function after options are saved)
- Adding custom post category to categories widget
- Custom Post Type with Sequence ID
- How to display the custom post related blog by category?
- Undefined index: custom_post_template_present
- Add an action based on custom post meta field
- Callback hooked to post_updated firing on new posts as well
- How to arrange custom posts in the backend/admin by custom taxonomy
- Adding LOAD MORE on a page
- save_post hook partly firing in update post
- Problem with checked box on wp car manager plugin
- Merging new theme and plugins from development site to production
- WordPress hide post from custom post-type on a single page
- Ultimate Members Default Post Layout problem
- Why do actions with class and public method don’t fire __construct()
- The function called on the wp head hook becomes null
- custom post type get_posts() function not work