I want to change the media list with additionally query

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

Get url from file uploaded in Media Library

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>

Upload thousands of images to WordPress without plugin?

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

shortcode to output multiple images urls from media library id

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

Function to get image from media library

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();

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)