Tag Info

New answers tagged

1

We can add the Featured option as a fake mime-type with: add_filter( 'media_view_settings', function( $settings ) { $settings['mimeTypes']['wpsefeaturedimage'] = 'Featured'; return $settings; }); It will show up like this: Then we can use the posts_where filter and check for our fake mime type: /** * Filter for featured images in the media ...


0

If you needed help to install WordPress I recommend you do not use custom media folder. Either stick to the Year/Month structure default, or put all your media in the wp-content/uploads folder (in Settings > Media > uncheck Organise my uploads into month- and year-based folders). Most WP installations use less than 100 photos and other media. That is ...


1

You're close - couple of things: $field is an array representation of the field, so you need to use $field['name'] which is the name of the field. get_field will format the value unless you set the third argument to false - we want the ID, not the post object/URL (or whatever setting you configured for your field return value) Your code won't delete the ...


0

I've needed to do exactly this for a plugin I'm working on and found a slightly different solution based on what Ogier did (which pointed me in the right direction thanks!) With the code provided by Ogier I found that the selected images were not appearing on top even with the extra comparitor code, so after a bit of digging around in the core and ...


1

Here are two filter examples: add_action( 'pre-upload-ui', function() { ?><h4><?php _e( 'Please Remember This And That! (pre-upload-ui)' );?></h4><?php }); add_action( 'post-upload-ui', function() { ?><h4><?php _e( 'Please Remember This And That! (post-upload-ui)' );?></h4><?php }); You might ...


1

Add the filter "ajax_query_attachments_args" in this way and URLs variables are sent to the class WP_Query the default is to send array(7) { ["orderby"]=> string(4) "date" ["order"]=> string(4) "DESC" ["posts_per_page"]=> string(2) "40" ["paged"]=> string(1) "1" ["post_type"]=> string(10) ...


2

You can adjust the attachment query in the media library popup, through the ajax_query_attachments_args filter. Here are two PHP 5.4+ examples: Example #1: Show only attachments that where uploaded during the last 24 hours: /** * Media Library popup * - Only display attachments uploaded during the last 24 hours: */ add_filter( ...



Top 50 recent answers are included