Post edit – Media Library – Only get images from current post

This will lock uploads to “Uploaded to this post” and will not show “All media items” or other options in WordPress media panels. Add this code to your function.php file add_action( ‘admin_footer-post-new.php’, ‘firmasite_mediapanel_lock_uploaded’ ); add_action( ‘admin_footer-post.php’, ‘firmasite_mediapanel_lock_uploaded’ ); function firmasite_mediapanel_lock_uploaded() { ?> <script type=”text/javascript”> jQuery(document).on(“DOMNodeInserted”, function(){ // Lock uploads to “Uploaded to this post” jQuery(‘select.attachment-filters … Read more

Is it safe and good practice to use do_shortcode to escape?

The WordPress Coding Standards sniffs treat do_shortcode() as an “autoescaped function”. This appears to have been discussed in 2015 in these GitHub issues: https://github.com/WordPress/WordPress-Coding-Standards/issues/167 https://github.com/WordPress/WordPress-Coding-Standards/issues/428 The explanation used when it was added to the list was: I discussed this with VIP support (#44195). David, after conferring with another team member, said that it’s unnecessary, as … Read more

Importing hard coded custom field into acf field

First off, you should know that get_post_meta() doesn’t create any custom fields (or metadata), it only retrieves the custom field’s value. But the WordPress functions that do create custom fields (for posts) are add_post_meta() and update_post_meta(). So that get_post_meta($post->ID, “mt_post_subtitle”, true) simply retrieves the value of the meta/field named mt_post_subtitle for the post (referenced by … Read more

ACF Date Based wp_query

I’ve modified your existing code.Can you please try the code bellow: $args = array ( ‘post_type’ => ‘exhibitions’, ‘meta_query’=> array( ‘relation’ => ‘AND’, array( ‘key’ => ‘exhibition_status’, ‘value’ => ‘past’, ), array( ‘key’ => ‘end_date’, ‘compare’ => ‘EXISTS’, ‘type’ => ‘DATE’ ), ), ‘meta_key’ => ‘end_date’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ‘post_status’ => ‘publish’, … Read more

How to change post featured image using a custom field of category?

You could filter the the_post_thumbnail() function, which will dynamically show the assigned category image across all your custom post type, rather than using acf_save_post to save the category image in the post featured image meta field. By filtering the the_post_thumbnail() for your specific post type, this means if you change the image on category in … Read more