Post Meta Emtpy on Publish Using Transition

I got it working by looking at this post/answer: https://wordpress.stackexchange.com/a/134283/17126 Seems it can’t be done, and I changed the get_post_meta line to: $message .= ‘Email: ‘ . sanitize_text_field($_POST[‘_email’]) . ‘<br>’; Also, I could see the $_POST data coming in from post.php on submission over dev tools. And finally, I changed my hook to publish_cpt which … Read more

How to get the Tags on Publish post hook?

Found Solution : If there is no data in the request_body, the we can also fetch it from the postID which is already we have. Changed Code: added condition if data not available, then get it from post id public static function saveDataInNotificationTable($ID,$request_body) { $post_data = json_decode($request_body); $tags = $post_data->tags; if($post_data == “” || $post_data … Read more

Check if checkbox is marked on publish/update post

Working code: add_action( ‘acf/save_post’, ‘fritlaeg_artikel_3m’ ); function fritlaeg_artikel_3m( $post_id ) { if( get_post_meta( $post_id, ‘fritlaeg_artikel_i_3_maneder’, true ) ) { // Getting a UNIX Timestamp $timestamp = time(); // Using WordPress Time Constants // https://codex.wordpress.org/Easier_Expression_of_Time_Constants $timestamp_after_hour = $timestamp + 0.5 * MINUTE_IN_SECONDS; // Define remaining parameters $args = array( $post_id ); $hook = ‘fritlaegning_clear_meta_data’; // Get … Read more

Allow Contributor to edit published post and filter by page id

You can use user_has_cap filter to check and grant capabilities dynamically. add_filter(‘user_has_cap’, ‘contributor_can_edit_published_posts’, 10, 4); function contributor_can_edit_published_posts($allcaps, $caps, $args, $user) { global $post; // Do we have a post? if ( ! $post ) { return $allcaps; } // Is the user a contributor? if ( ! isset( $allcaps[‘contributor’] ) || true !== $allcaps[‘contributor’] ) … Read more

How to modify Publish metabox?

I always do it with Frank Bültge’s Adminimize in Global Options, you’ll find Your Own Options in the left column you put any name for your reference in the right column you put the ID or Classes you want to hide if I’m not mistaken, you’d want to hide this #visibility.misc-pub-section,.misc-pub-section.curtime.misc-pub-section-last Here’s a reference list … Read more

publish_post action hook not working

If you did this instead… function the_fat_lady_sings() { wp_die(“this plugin is a far harder than i imageined”); } add_action(‘publish_post’,’the_fat_lady_sings’) I think you will see that it does work. The problem you are having with the echo is because WordPress processes the submission and then redirects back to form. You’ll never see the echoed string. That … Read more

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