Tag Info

Hot answers tagged

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


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


2

After struggling around for days through the poorly documented media modal source code and using code from the gist (thanks, Fabien), I came up with a solution: JS: wp.media.controller.Custom = wp.media.controller.State.extend({ initialize: function(){ this.props = new Backbone.Model({ custom_data: '' }); this.props.on( ...


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

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


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


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

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



Only top voted, non community-wiki answers of a minimum length are eligible