The wp_insert_post()
function triggers the publish_post
hook again leading to an infinite loop. Try this change:
remove_action('publish_post', 'copy_post_to_blog');
wp_insert_post($post);
add_action('publish_post', 'copy_post_to_blog');
Related Posts:
- Changing Plugin Load Order
- How do I ensure I can loop through every enqueued script and CSS?
- Difference Between Filter and Action Hooks?
- How many times will this code run? (or, how rich is grandma?)
- add_action hook for completely new post?
- Prevent network activation of plugin
- Uninstall script for a plugin in Multisite
- WordPress Hook for user register
- Global Objects and Public Methods
- Using filters and actions for plugin API?
- Explanation of the “posts_join” and “posts_fields” filter hooks?
- How do you use the plugin boilerplate loader class to hook actions and filters?
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- Error getting correct blog_id on MU from functions.php
- Call activation hook multiple times
- What’s the difference between hooks, filters and actions? [duplicate]
- Two-step login process – Is it possible?
- How to check if certain plugin exists and in expected version
- How can I hook into existing WordPress Bulk actions?
- Get returned variable from a function to add_shortcode function
- How to use wp_set_password in a plugin?
- WordPress Media mime type filter problem 4.0
- Earliest WP Hook to Safely and Reliably Redirect
- Define a function outside a class and call the function using action or filter hook
- Is it possible to modify the media library admin screen?
- What function to hook for changes made in status and visibility of a post
- Synchronize Custom post type tags to WordPress default posts tags
- Order of Operation for these three hooks
- Modifying values with add_action to be sent to db
- save_post hook not triggered in WP v3.6.1
- Customize multisite site creation with user data
- how to activate plugin network-wide, and save setting across sites
- Hook into theme-switching later than `setup_theme`
- Is it possible to delay execution of shortcode output callback?
- WordPress Ajax callback function from plugin – OOP
- What is difference between blog id and site id?
- Hook to get image filename when it is uploaded
- How to display a message about updates in the plugin list
- Why my database table not created on activation?
- How to create a Tools menu on the Network Admin dashboard from a plugin
- Act on user meta updated, but only once
- Is there any way to allow a plugin to write over a previous version?
- Execute Hook on the footer or header after activating a plugin
- best practice for query string values – get_query_var always empty for my value supplied in query string
- get_current_screen() return null
- Modifying meta tags after doing ajax call in plugin
- how to add custom functionality after woocommerce place order button
- Where to add hooks in a class
- How To Change Post Author Default?
- Conditional hook based on the core function that is calling it
- What should happen when a WordPress Plugin is activated across the network (Network Wide Activation)
- Send push when new post is published in a certain category
- Multiple Plugin best practice in Multisite
- I have 2 plugins using the same wp_login action hook and one is not working
- how to invoke wordpress API from other existing PHP system
- use of do_action() without any functions attached
- How dynamic action login_form_{action} is working
- WP Multisite login not working on one subsite. Possibly cookies/ history issue?
- How to get all queries’s results after they have executed?
- register_activation_hook on multisite
- Odd map_meta_cap $args on post edit — sometimes integer, sometimes string
- How can I create a custom plugin that allows anonymous users to signup without registering?
- Bind a function with its own argument to show something dynamically after every content
- What’s the hook for filtering every texts of site?
- Hook add_attachment error
- Associate multiple email addresses with the same user account, so they can log in with either
- WP: Search and replace in DB programmatically
- Update variable value via add_filter
- Custom filter not working
- hook update_option/updated_option empty $old_value and $value
- Configure WordPress to Generate Scheme-less Relative URLs
- How to get current logged-in user details in multisite?
- How to find list of all functions bind to a particular hook from my plugin?
- add_action wp_ajax_ not loading in plugin file WP Network
- Ajax +wordpress onClick link redirect to new page and create html content
- Clean way to initialize plugin in newly-added site when plugin has been network activated?
- How to replace settings in WordPress plugin from a theme
- Is there anything special required to make a plugin work in a multisite environment?
- Creating posts with links from a txt file
- apply_filters() and call_user_func() to define and call a function outside a class
- Problem in plugin debuging in wordpress
- WordPress Plugin Boilerplate – add actions and/or filters based on user’s role
- OOP development and hooks
- Plugin Development – Call to undefined function comment_exists()
- Replace “content-area” of themes 404 page with plugin?
- Add_action not calling callback function
- how to retrieve post_id under woocommerce_add_to_cart_validation hook?
- add_option_{$option} action hook not being called
- Function not working on any file other than the main plugin file
- Multi hook deploiement
- Can I use a hook other than ‘init’ to handle form submissions?
- woocommerce single product page hook not working
- How can I set a dynamic value for post_updated_messages based on return value of post_updated?
- What is the use of wp_schedule_event hook?
- Change Admin menu placement using hooks
- How do I replace title with my plugin?
- Looking for Hook that is fired after a plugin or wp upgrade is installed/updated
- Woocommerce: block user removing cart item
- Insert plugin html content to a specific spot in the frontpage
- get_term_by() returning null on plugin