Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

save-post

Resaving posts to update static blocks

Resaving posts to update static blocks

Categories block-editor Tags block-editor, save-post

Save_Post change Custom Post Type Post title to post id number

A very easy way to accomplish this would be to add something like this into your themes functions.php file: function update_post(int $id, \WP_Post $post, bool $update) { // Case the post object to an array $data = (array) $post; // Set the title to the ID of the post $data[‘post_title’] = $id; // We need … Read more

Categories PHP Tags custom-post-types, php, save-post

Detect, if post is saved manually or programmatically in save_post-hook

Detect, if post is saved manually or programmatically in save_post-hook

Categories save-post Tags save-post

Set post status to draft after validating post meta values in save_post hook

After some research, I altered my approach to validate the meta values in the following way: Create a new meta key(for post type) to store the validation (0 and 1). Initiate it with 0. This need not be kept/shown in the meta form. While saving the meta fields (preferably within save_post hook), set its value … Read more

Categories custom-field Tags custom-field, post-status, save-post, validation, wp-update-post

Multiple triggers when publishing, saving or updating a post in WordPress

Multiple triggers when publishing, saving or updating a post in WordPress

Categories custom-field Tags custom-field, save-post

A way to see real changes of posts inside an action?

A way to see real changes of posts inside an action?

Categories actions Tags actions, save-post

How do I set a custom post type Category after import using wp_set_post_terms

The answer is don’t use wp_set_post_terms, use wp_set_object_terms instead. wp_set_post_terms only works with the built-in post object.

Categories hooks Tags actions, hooks, save-post, the-events-calendar

Get category of post inside save_post hook

Your code calls get_the_category() but it doesn’t use the value returned. // … if ( isset( $_POST[‘img-destacada’] ) ) { $categories = get_the_category($post_id); $img = ”; // $categories should contain either an array of WP_Term objects, // or an empty array. if ( ! empty( $categories ) ) { // Here I’ve used the slug … Read more

Categories functions Tags categories, functions, hooks, save-post

How to use wp_set_object_terms depending on page ID?

How to use wp_set_object_terms depending on page ID?

Categories custom-post-types Tags custom-post-types, custom-taxonomy, functions, save-post, terms

Use save_post to generate file on wordpress

Use save_post to generate file on wordpress

Categories save-post Tags save-post
Older posts
Newer posts
← Previous Page1 Page2 Page3 … Page40 Next →
+ More

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
Next Page »
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress