Tag Info

New answers tagged


From the WP-CLI documentation about wp post delete: wp post delete $(wp post list --post_type='attachment' --format=ids) See wp post list for additional information.


Found this question doing my own research, and ended up developing a richer solution that I thought might be valuable. If you want to know the url of the media size selected by the user, then the following code (full jQuery code below) will do that for you: jQuery(function($) { // Bind to my upload butto $(document).on('click', ...


The correct hook to add/remove menus in admin area is admin_menu. Also, be aware that current_user_can is intented to check user capabilities, not user roles. See current_user_can documentation and notes. add_action( 'admin_menu', 'my_remove_menu_pages' ); function my_remove_menu_pages() { $user = wp_get_current_user(); if( ! empty( $user ) ...


So far, the only workable solution I've come up with is to run a new query within the ajax_query_attachments_args filter. It's definitely not ideal but works as expected in the absence of a more efficient alternative: function restrict_media_library_by_width($query) { $include = array(); $exclude = array(); $temp_query = new WP_Query($query); ...

Top 50 recent answers are included