Tag Info

New answers tagged

0

Can't test at the moment but I'd try rewriting the date to variable code from: $time = current_time( 'mysql' ); $y = substr( $time, 0, 4 ); $m = substr( $time, 5, 2 ); $subdirectory = "/$y/$m"; To: $y = date('Y'); $m = date('m'); $subdirectory = "/" . $y . "/" . $m;


0

I'm not sure if this is exactly what you're looking for, but you might want to check out: get_attached_media() and wp_get_attachment_url().


0

The limiting factor appears to be in your .htaccess file: php_value post_max_size 1M The post_max_size needs to be at least equal to the upload_max_filesize, so increase that to 100M. The settings in .htaccess should override the settings in php.ini. Edit: If that doesn't work, and since you have full root privileges, you can modify the main php.ini ...


3

Thank you for the response everyone. I played around with macemmek's solution and I think it led me to an even better solution: add_filter( 'wp_unique_post_slug_is_bad_attachment_slug', '__return_true' ); That is all that is needed. This will automatically 'skip' the default assigned slug on any attachment. So an attachment that might normally get the ...


3

You may hook wp_unique_post_slug() and append some string to the original slug if the post is an attachment type. The original slug based on post title will remain free. UPDATED after Rachel Baker's comment: original slug suffix is some random string. It does not guarantee uniqueness but may be enough for simple use cases. add_filter( ...


1

Tom's comment is correct, in that this is normal behaviour and there is not much you can do to stop it. But you can change slugs after things are uploaded/created. While you shouldn't do this if the links are known/publicised/listed on search engines, if you're just trying to fix this problem occasionally after an upload then you can edit the slug of the ...


0

As of WP 3.7 there is a much better way via the ajax_query_attachments_args filter, as provided in the documentation: add_filter( 'ajax_query_attachments_args', 'show_current_user_attachments' ); function show_current_user_attachments( $query ) { $user_id = get_current_user_id(); if ( $user_id ) { $query['author'] = $user_id; } ...


1

You have to change: 'post_type' => 'post', To: 'post_type' => 'your_custom_post_type_name', And a all the reference to standard post. Also, you should add the filters only for main query or you can end up with issues in secondary queries. Bellow an example code for gallery custom post type. I was trying to debug the code you posted (taken ...


0

I know it's a bit late, but I'm having the same problem and looking for a solution. This other question seems to describe the same problem, and the solution is that maybe the needed image libraries (GD or ImageMagick) are not included by the server configuration. That was the case for me. I hope this helps someone. ^^


0

While uploading an image via media uploader, WP automatically makes at least 3 additional sizes for different purposes. So You have to manually upload all images one by one.


2

Thanks @kaiser but not need to go through your solution I found a easy one and I'll share here for newbie likes me. If you're working on a WP Network site then the steps are: At the top, hover over My Sites and then click Network Admin. At the left, hover over Settings and then click Network Settings. Scroll to the bottom of the page and change the Max ...


1

There's a filter named 'upload_size_limit' where you should be able to change the value. Just add a small mu-plugin for that job: <?php /** Plugin Name: (WPSE) #177620 Alter Upload Size Limit */ add_filter( 'upload_size_limit', function( $limit = 0, $u_bytes = 0, $p_bytes = 0 ) { return ( in_array( get_current_screen()->base, array( /* Add ...


0

I guess you copied that code from somewhere. Just from reading through it, I don't see wppf_gallery_ids set anywhere aside from the init function, which means that it can't update anything as the check is empty. I see two options: Either update it during selection within the select function, or just push wppf_new_ids into the wppf_gallery_ids array. To me ...


0

Try this: function rearrange_media_tabs($_default_tabs) { $_default_tabs = array( 'custom' => __('Your Tab Name'), 'type_url' => __('From URL') ); return $_default_tabs; } add_filter( 'media_upload_tabs', 'rearrange_media_tabs' ); From the Codex: https://developer.wordpress.org/reference/functions/media_upload_tabs/


1

I've solved it: var frame = wp.media({ button : { text : 'Wählen' }, frame: 'post'/*, state : 'insert-image',//gallery-edit states : [ new insertImage() ], library : { type : 'image'}*/ });


1

Sounds like you need something like: add_filter('upload_mimes', function ( $mimes = array() ) { $mimes['mobi'] = 'application/x-mobipocket-ebook'; $mimes['epub'] = 'application/epub+zip'; return $mimes; } ); to support the uploads, but you might have to adjust the mime types to your needs.



Top 50 recent answers are included