The problem with ‘save_post’ is that it gets called when you actually change something on the post edit page, if you just click the update button without changing anything, it doesn’t get called. So, i would say use ‘pre_post_update’ action hook instead of ‘save_post’ or use both. Also for debugging try put some test code in your custom function and test it to make sure it is being called.
Related Posts:
- Best Practice for PHP
- Where to get information about array fields in $_REQUEST?
- WordPress URL Rewrite not working
- Redirect to Page after Post Submit
- wp_remote_get returns an error for valid URL
- Install will not load: PHP does not have MYSQL installed
- Constructing a custom login form using ajax
- Error when requesting password reset email – wp authentication
- How to do conditional publishing?
- New Plugin Review
- Create custom blocks for bootstrap
- How to get the post_id from postmeta
- Problems with function on function.php
- Adding code to child theme functions.php to override parent theme behaviour doesn’t work
- How to retrieve the content (with a specific ID) via ajax by clicking a link tag
- WordPress: Remove link in the_tags
- Set WP_MAX_MEMORY_LIMIT higher than PHP.ini memory_limit
- Change output based on text field value
- Function not working at one place
- How can I load a PHP page without using a Template?
- How to add clearfix class according to to the posts number?
- Multiple options not staying selected after saving
- Where to place PHP code that inserts (or doesn’t insert) menu item?
- Importing Geo data into wordpress database
- how to add three default images to wordpress?
- Where to find documentation for CPT block template? (PHP)
- Sort the result of the main Query in shop page by a custom taxonomy
- WP Post-Thumbnail
- Responsive Header for Phone
- Programmatic Login from 3rd Party site
- Loading the same WP_Query in two different wordpress .php templates
- Save Search System
- foreach loop still echoes array
- Media upload ERROR Message Showing in BOTTOM of the page wordpress
- Setting default category base on theme activation
- parts of url disappear when using # inside href=”” [closed]
- Help with Sub and Sub-Sub Navigation
- Hide menu items in WordPress
- Best way to schedule daily change in CSS parameter
- WordPress Woocommerce – Product Type [closed]
- WordPress installation permission errors
- Custom field values to taxonomy terms
- List posts that don’t have a specific tag?
- Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
- Returning data instead of echoing/printing
- Correct way to enqueue page specific CSS file
- Wrapping a Sidebar within
- What is the difference in the WP memory limits?
- Content filter won’t work
- How to retrive the text : No movie by this actor
- Is the 404 page automatically displayed if a loop returns nothing?
- update_post_meta only updating on last loop of foreach
- Link blogname and blogdescription to the Options Framework
- Why does the post_type_link hook everything twice?
- Get related product based on subcategory selected from category id with ID 142
- Customizer: How to change Header Image description
- Fetching Initials of the Commentator in the WordPress Website
- fetch woocommerce product with custom taxonomy
- PHP Helper Class to create shortcodes
- How can I Use 2 databases with one WordPress install
- How to set a featured image (thumbnail) with PHP?
- Output custom text field as unordered list
- Why doesn’t global $wp_query not get hooked?
- Is it legal to redefine wp_password_change_notification in a mu plugin?
- Can not call .php files after switching to %postname%
- Checking page before applying image restrictions while uploading
- WP Container Displaying Only on First Page of Archive
- AWS Lightsail WordPress – connect to database on instance using mysqli
- Update Images after edit via php
- Using wpdb to connect to a different database is not working
- PHP error on local server install
- how to use 2 index.php file One for mobile and one for desktop
- ACF under category name in shop page [closed]
- Accordion headings cuts off to second line on collapsing a accordion heading (used acf repeater)
- Using $this with an anonymous function in filters
- WordPress Recent Posts – Loop
- Changing default WPMU emails to be send thorugh Campaign Monitor Transactional emails
- Dynamic_sidebar load in string makeup
- Post Meta statement?
- not able to access $_POST on backend profile update
- WordPress Single Post Pagination Numbered and Navigational
- How to include non-users in wp-admin redirect?
- Add disclaimer before certain posts and pages
- Use Custiomizer to setup meta theme color tag
- I changed the password for the database user of my website, updated wp-config.php and wordpress asks to be reinstalled
- Click to expand menu
- WP_Post is not from correct array
- Post formating on Home page
- Showing custom field contents without listing description
- Using ‘array’ method in wp_nav_menu causes it to disappear
- Search box background on a different page template
- How to add together (get the sum) a field from all author’s posts
- two body tags on all WP pages regardless of theme
- Load php function with AJAX on modal window
- Hide page title
- Edit Image/Image Details – Replace button missing
- Display biography post for today’s birthday person
- get user role. parameter id return type string [closed]
- Custom Filtering date with newsletter
- WordPress critical error after trying to update to 6.2 – Fatal error: Allowed memory size of 268435456 bytes exhausted