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

As to No. 1 - remove_post_type_support( $post_type, 'comments' ); needs to be hooked to init. Codex: https://codex.wordpress.org/Function_Reference/remove_post_type_support There seems to be comments_open filter as well: function filter_media_comment_status( $open, $post_id ) { $post = get_post( $post_id ); if( $post->post_type == 'attachment' ...


0

Ah, this is silly, but it turns out there was a very obvious reason why media_sideload_image() wasn't working. My wp-content folder had the wrong the permissions from when I transferred it to my local environment and I wasn't able to upload anything. Changed the permissions and it's working fine.


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 ...


0

I managed to resolve this problem with changing Apache server configuration: there is a KeepAlive flag which needs to be turned Off. More about this flag: Apache Optimization: KeepAlive On or Off?


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( ...


0

I ran into the same problem and tried doing a google search and came up with so many technical suggestions that I could not begin to even start as I'm not tech savvy. I did run into an article where a blogger said she contacted her hosting server and they changed the PHP version. It may or may not work for me but I was going to try. Only I didn't know how ...


0

Based on your code, you have put the wrong condition within if statement. You can check the first example here: Media handle upload


0

So I dont know if its the best way but my problem was the if statement surrounding the require_once on the necessary files that contain the function. Commented out the IF statement and it did the trick. I'll go have that coffee now ;) //if (!function_exists('wp_generate_attachment_metadata')){ require_once(ABSPATH . ...


0

Change upload directory for PDF Files seems to be a good stepping stone forward. Although untested, looking at the code my adaptation would be along the lines of... <?php add_filter('wp_handle_upload_prefilter', 'custom_media_library_pre_upload'); add_filter('wp_handle_upload', 'custom_media_library_post_upload'); function ...



Top 50 recent answers are included