Get Post ID with insert/edit link

Not an exact answer to your question (hooking into the insert/edit link functionality), but possibly an alternate method that can achieve the same goal (inputting a permalink, outputting a Post ID): https://codex.wordpress.org/Function_Reference/url_to_postid

save_post only saves meta data on second save

Did you try removing the IF statements and use save_post hook instead of save_post_listing to see if an IF statement is blocking the wp_set_post_terms? Also try wp_set_object_terms instead of wp_set_post_terms. Furthermore, if you can make sure it has to do with the if(get_post_meta($post_id, ‘wpcf-proprty_online’, true) == ‘y’) statement, then this post_meta has not been updated … Read more

Return code from save_post action?

Actions should not return anything, and action hooks are not built to do anything with a returned value. (That is what filters are for.) If you look at the source for that particular hook, you can see that even if you return something nothing happens. Whatever you return isn’t captured. It vanishes from the code. … Read more

Update post on save

A post’s title (post_title) is not saved in meta data; it’s a field within the post table. Here’s an updated version of your original code. Infinite loop is prevented by removing and then readding the wpse246957_update_post_info callback. Post title is successfully saved with the suffix – $post_id A check is in place to prevent the … Read more

Minimum Word Count Before A Post Can Be Made Pending Review

Those transition post hooks run after the post is saved. You will have to interrupt the process earlier. I would hook to wp_insert_post_data. function minWord($data){ if (current_user_can(‘contributor’)) { $num = 150; //set this to the minimum number of words if (str_word_count($data[‘post_content’]) < $num) { $data[‘post_status’] = ‘draft’; } } return $data; } add_action(‘wp_insert_post_data’,’minWord’); Seems to … Read more

Check if value has changed on save_post

In the end I checked against and updated a new meta value on each save. $screen = get_current_screen(); if ( $screen->base == ‘post’ && $screen->post_type == ‘sessions’) { if ( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return; if ( isset( $_POST[‘session_status_tax’] ) ) { $status = $_POST[‘session_status_tax’]; } else { $status=””; } $prev_term = get_post_meta( … Read more