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:
- Best collection of code for your 'functions.php' file [closed]
- Tips for using WordPress as a CMS? [closed]
- Updates for a private plugin?
- Unable to check if plugin is active
- How to upload image with simple form?
- Edit plugin without hooks in functions.php
- Making plugin unique to not conflict with plugins with the same name
- How to store ACF custom fields data in a custom table
- Is dynamic forms/entries possible in Widget?
- How to get posts by content?
- Too many variations in WooCommerce
- Trying to disable plugins doens’t work
- WordPress plugin DB upgrade
- How is the ” wp_get_update_data ” function used?
- woocommerce hook publish product
- Plugins won’t update when WordPress says they’re updated
- WordPress multiple widget in single plugin
- Have Plugin Handle Specific URLs
- Layout shop page: resize images and columns
- Invalid shipping method, WooCommerce [closed]
- How to integrate plugin in WordPress theme
- WordPress with Git deployment issues
- Creating Tables on Network Activation
- Different UI in WordPress
- How to add links in .po (language) file in wordpress?
- Is there a way to share your Facebook Page’s stream on a WordPress page or post?
- How to add equivalent of php include to one page (as plugin?)
- Does any one have Idea to get these functionalities with the plugin wp-multi-network
- CRUD and Frontend show from a custom table without shortcode
- Add Plugin options as subpage to Theme options page
- Image upload and download from front-end
- Child Pages Short Code plug-in and hover capabilities?
- correct way to include a library(and its dependent libraries) in wordpress development
- Issue Tracker from pre exsisting table [closed]
- How to enable AMP for custom single template with custom database
- Problem with the Loop – want to limit the access to three free articles
- Custom table naming/access convention for multisite: $table_prefix vs base_prefix or other?
- Woocommerce: how to change ‘Cart Updated’ message [closed]
- Stop Plugin from Getting Styles from Other Plugin
- Cannot access my wp-admin after installing Gzip compression [closed]
- Front-end CSS Library for plugin [closed]
- Default taxonomy template in plugin, override in theme
- WordPress Plugins Don’t Automatically Update
- Simply poll & Events Calendar plugins clashing
- WordPress plugin Post Creation [closed]
- How I can change the required capability for an admin menu without editing the plugin file?
- How to add support for caching plugins for my own plugin?
- wp_enqueue_scripts
- woocommerce search by sku and title ajax
- How to remove a CPT Menu from the Root Admin only
- Get post_id on clicking a link in WordPress
- WordPress.org: How to add a plugin for certain countries?
- Wp Debug Enabled True Notices and Warning
- Webservice credential storage [duplicate]
- PHP mobile redirect Endless loop
- Error: Can´t access facebook comment plugin admin page
- Is there a way to keep youtube videos from displaying on home page, and display only on single posts?
- Cache plugin for medium traffic news blog
- Deregistering and registering javascript breaks plugin
- how to convert XML from URL to HTML
- i want to rewrite my custom plugin url
- [Plugin: WordPress.com Stats] Javascript not being added to footer
- Strange Cached File in Super Cache
- Wp-minify doesn’t seem to minify my JS code
- eaccelerator PHP error
- Plugin Hook When New Author Added
- How to hide plugin submenu title in drop down in admin panel in wordpress?
- Best approach to make all tags searchable by the wordpress search function
- WordPress – Ultimate Auction for WooCommerce
- Fail on admin_enqueue_scripts when I try it to upload a CSS file to my WordPress Plugin
- Post source link plugin – small modification
- Can we hide a certain user in WP?
- Configure upload folder on WoComerce
- Show Custom Post on Frontend
- Hooking into the HTML header container
- Problem Advanced Custom Fields PRO
- Block plugin update possibilities (but not by hiding notifications)
- Execute function activate/deactivate plugin in specific pages
- Why can I not deregister my style and script on custom post type?
- WordPress Ajax request “Failed to load resource: the server responded with a status of 400 ()”
- Using multi-dimensional array with filter
- PHP header() not available to use in my plugin
- WordPress doesn’t save a post revision when changing CMB2 custom fields
- database – multiple wordpress installations using same database – can they share plugin settings?
- HyperDB failover Delay
- Displaying friend’s posts only
- Display dashboard other than admin user
- Creating themes using the one Plugin (Toolkit)
- WordPress Categories from Plugin
- How change menu for each user in plugin?
- Check if user is in a group of another site within multisite network [closed]
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- Facebook meta tags not working properly on WordPress Site
- Enforce conditions only for draft posts using WyPiekacz, ignore pending and published posts
- is there a plugin that allow editing pages from within pages without entering admin panel?
- Site is setup statically – how to make it content managable?
- WordPress site show white screen after updating some plugins (URGENT) [closed]
- Modifying lightbox plugin to allow for quoting, Does this exist? [closed]
- How to escape html code?
- GTranslate Plugin – Showing Different Codes With if-else