I don’t have time to thoroughly test this (and your code is not of the complete class anyway), so understand that there is a lot of guessing to this answer, but save_post will run again when you call wp_insert_post. I think it may be that second run that is causing the problem. If so, you should be able to avoid the issue by having your callback remove itself from the save _post hook.
add_action('save_post', array($this, 'save_post'), 1, 1);
public function save_post($post_id) {
remove_action('save_post', array($this, 'save_post'), 1, 1);
Related Posts:
- Changing title of a page dynamically from within a plugin
- How do you allow plugins to be updated using the GUI without breaking your subversion repository?
- category_name not working (not showing up in sql query debug)
- Custom plugin settings: clicking “save changes” does not display success message
- WordPress Hook that will run when media file deleted
- Prevent multisite sites from using a plugin
- Plugins won’t auto-update on IIS
- Make plugin uninstalable on older versions of WordPress
- Get the current taxonomy product category title in woocommerce
- Remote plugin activation hook
- Custom Post Type causes Page Not Found
- How can I filter blog name?
- Detect if a plugin was included in a certain page
- How can I make the “Preview Post” button save and preview in the same window?
- how to load tinymce external plugin
- Organising the plugins folder in wordpress
- Cannot run the code after I activate the plugin
- Plugin could not be activated because it triggered a fatal error. (No Error??)
- Weird problems after recovery from security breach
- How to retrieve custom meta term of category taxonomy from WP Rest API?
- Problem with wp_enqueue_scripts in plugin
- Best Practice: Remove data on deactivation or uninstall?
- WooCommerce & Caching [closed]
- google conversion code
- myCRED custom hook preferences doesn’t update creds and log
- Limit Number of Taxonomy Terms (Images) Displayed
- How can I create a custom shortcode that will return a custom post type by ID?
- importing plugin w/ settings from one WP installation to another
- After plugin options changed hook
- How to make a slideshow shortcode based on the WordPress gallery shortcode? [closed]
- How to enable qTranslate languages tabs in custom plugin page
- Plugin: Google Analytics for Dashboard error – Timestamp is too far from current time
- Linking an image to open a youtube video in lightbox/fancybox in wordpress
- Making a Template for a CPT created by a plugin
- Woocommerce dependent plugin
- Get sent emails without email logs
- External CSS in WordPress Plugin [closed]
- User registration
- What will happen if i deactivate my visual composer plug in? [closed]
- Migrating problem from Joomla to WP
- WP plugins for Product web catalog [closed]
- User Signup in Multisite – Need Plugin or Advice
- Plugin – Social media share buttons
- Notice: Uninitialized string offset: 0 in social sharing mu-plugin
- How to deploy gutenberg on my own [closed]
- Adding Static Image to WooCommerce Content-Single-Product template
- How to protect WordPress from security scanner [closed]
- how can I query all wordpress users of a blog
- Automate paragraphs in a post page to have a unique anchor link
- Error in pdf generating plugin using FPDF
- How to create WordPress custom end point with multiple parameters?
- Text change in Advanced Customs Fields [closed]
- After updating the WordPress getting a syntax error in the console
- How to redirect to same page after form submission
- How to add a new column with text fields to WooCommerce Cart List?
- How to use filter to disable adding a product to wishlist?
- How to use apply_filters?
- Call a function for social sharing
- Categories from front-end, checkbox selection doesn’t work
- Strange Behavior on New Theme Points to Idiocy
- Dynamic URL Rewrite for Custom
- How can i export and import my plugin option WordPress
- How can I adjust my function so the page editor still loads in the backend?
- Why won’t wp_enqueue_script work within any plugin file?
- how long do restored versions take to go live?
- Help to Create a Simple Plugin to make a post
- WordPress Theme footer remove after use Autoptimizer plugins
- WordPress fresh installation did not update default plugin and themes to latest version
- headless wordpress
- WPGlobus Multilingual – REST API
- Defining constant in a plugin to use in another plugin
- How Can I display Specific User Pages?
- Any way to self-host plugins and update them like wp-hosted plugins does?
- Custom SportsPress list
- Why is the WordPress update_option not working in this code?
- Plugin Post 2 Posts: How to list most connected posts?
- How to prevent intermediate images from being created but keep the sizes available for selection in the media library?
- How to set the default options on an existing plugin in a WP MU new user install
- Custom Post type plugin breaking the front page shows dashboard?
- Display static pages instead of category, in code
- Additional scrollbar appears inside the browser on every page + lag scroll -Winner theme
- Call to a member function get_page_permastruct() on null
- Quiz plugin where we can import question from Excel file?
- Automatically put a menu on every post
- ERROR: Cookies are blocked due to unexpected output – no access to FTP
- Custom GD Star Ratings Stars [closed]
- How do I transfer my plugin data?
- How to give different user access to different people?
- hide particular category post from front page only [closed]
- which plugin is this? [closed]
- Adding a script & php to functions.php
- Divi Template A Few Questions
- Trying to use wp_register_script/style and enqueu them from an array – getting an error [duplicate]
- Real estate schema markup not showing up on Rich Results test
- qTranslate‑X is not translating all shortcodes
- How do I call an action hook into wp_ajax hook callback function
- Problem with a shortcode generating a error [closed]
- Can’t update plugins in WordPress, system returns -1
- Adjusting Website Display at 100% Zoom
- How can I hide Dashboard notifications for just one particular plugin?