What is “open()” in MediaUpload?
What is “open()” in MediaUpload?
What is “open()” in MediaUpload?
Using the component outside the editor. select(‘core’) is null
To ignore dots (.) in the search parameter s, for all backend searches, we can use: /** * Ignore dots in all backend searches */ add_action( ‘pre_get_posts’, function( \WP_Query $q ) { if ( is_admin() && $q->is_search() ) $q->set( ‘s’, str_replace( ‘.’, ”, $q->get( ‘s’ ) ) ); } ); We can further restrict it … Read more
I had similar question this morning I recommended this plugin
As said in comments, it’s not a good idea editing WP core files. You can easily modify the query that displays your media posts by adding the following code to a plugin or your theme’s functions.php add_filter( ‘pre_get_posts’, ‘_wp_media_pre_get_posts’ ); function _wp_media_pre_get_posts( $wp_query ) { global $pagenow; if( ! in_array( $pagenow, array( ‘upload.php’, ‘admin-ajax.php’ ) … Read more
If understand your question correctly, I think this can get the job done. Use get_attachment_link instead of wp_get_attachment_url and then echo the title. <?php $attachment_id = 2582; $attachment_page = get_attachment_link( $attachment_id ); ?> <a href=”https://wordpress.stackexchange.com/questions/255020/<?php echo $attachment_page; ?>”><?php echo get_the_title($attachment_id ); ?></a>
I’ve modified method wp_update_attachment_metadata from wp-includes/post.php (line 5070) to this, just during the Import: /** * Update metadata for an attachment. * * @since 2.1.0 * * @param int $attachment_id Attachment post ID. * @param array $data Attachment meta data. * @return int|bool False if $post is invalid. */ function wp_update_attachment_metadata( $attachment_id, $data ) { … Read more
Running the wp media regenerate command from WP-CLI with the –only-missing argument is quite fast (takes about 30 seconds for 4000 images) and rebuilds _wp_attachment_metadata correctly: wp media regenerate –only-missing
Try this function image_thingy($atts) { // Merge attribtes from shortcode with defaults extract(shortcode_atts(array( ‘id’ => 1, ), $atts)); // Extract id’s from shortcode attributes and convert into an array $ids = explode(‘,’,$atts[‘id’]); $output=””; // Variable that holds the shortcode output, at the end this will be returned // Loop through ids and fetch urls, and … Read more
Here you go: function get_media_all_wpa14177(){ $args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ =>’image’, ‘post_status’ => ‘inherit’, ‘posts_per_page’ => -1, ); $query_images = new WP_Query( $args ); $images = array(); foreach ( $query_images->posts as $image) { $images[]= $image->guid; } return $images; } Usage: $Images = get_media_all_wpa14177();