save_post hook is not called when post is saved

A quick way of debugging the save function before redirection – is to die(print_r($post_id)); // or var_dump($post_id); this will stop all PHP from continuing and is fast for small debugging where you don’t need an entire log. throw that into your function, and see what happens in it – change the variable to see if … Read more

Custom Post Type Metadata Not Saving

The primary issue is your save_post action isn’t firing because: add_action( ‘save_post’. ‘save_meta’, 10, 2 ); should be add_action( ‘save_post’, ‘save_meta’, 10, 2 ); You also have inconsistency between client-name and _client_name, but without seeing the field_value function, I’m not sure if that’s a problem or not. I would also use something more unique than … Read more

Create post revision on slug change

If you’re comfortable with PHP, it would be possible to keep track of when the slug is updated. The only way I can think of is a bit complicated: Make sure revisions are enabled, both for your install and for the post type you’re targeting. You’ll have to determine how many revisions you want to … Read more

Bug: Post needs to be updated twice when adding action for save_post hook

You’re doing several things wrong, and they’re all silly, avoidable, basic logic mistakes. Firstly, you’re not checking if this is an autosave. Autosaves do not save the custom fields, only the original core wordpress fields, like content, so an autosave will giv eyou unset/blank values. Add this to the top of your save function: if … Read more

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