Updating post data on save (save_post vs wp_insert_post_data)

At first, Data was sanitized here (line 2997). If you don’t want any plugin/theme run on action save_post. User function remove_all_actions to remove all functions hooked to action save_post. function post_save_action($post_id, $post, $update) { if ($this->is_temp_saving_post($post, $post_id)) { return; } // Check user permissions if (!current_user_can(‘edit_post’, $post_id)) return; // Update post if (!$this->is_proper_post_type($post)) { return; … Read more

How to inform the user that the save was not successful?

Handling admin notice on Edit Post When action related to post or editpost, we will be faced with redirect_post function. There are two filters you can use to handle the post messages, redirect_post_location and post_updated_messages ( see the list messages at https://core.trac.wordpress.org/browser/tags/4.8/src/wp-admin/edit-form-advanced.php#L135 ). Here the sample code how to handle the messages. Create new message … Read more

Add category only if post has custom taxonomy category

wp_get_post_terms( $post_id, $taxonomy, $args ) expects third param to be an array of arguments. Params $post_id (integer) (optional) The Post ID Default: 0 $taxonomy (string|array) (optional) The taxonomy for which to retrieve terms. Defaults to post_tag. Default: ‘post_tag’ $args (array) (optional) Overwrite the defaults Default: array My guess is that $old_term is being set to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)