Add instructions For Media Library Uploads

Here are two examples using the pre-upload-ui and post-upload-ui hooks: add_action( ‘pre-upload-ui’, function() { ?><h4> <?php esc_html_e( ‘Please Remember This And That! (pre-upload-ui)’, ‘wpse’ );?> </h4> <?php }); add_action( ‘post-upload-ui’, function() { ?><h4> <?php esc_html_e( ‘Please Remember This And That! (post-upload-ui)’, ‘wpse’ );?> </h4> <?php }); You might want to adjust this further to follow … Read more

Get the path of the first attached media (single.php)

I tried to write some snippet with the help of WordPress codex. Please check below and update it further as per your needs. I hope this helps: global $post; $args = array( ‘numberposts’ => 1, ‘order’ => ‘ASC’, ‘post_mime_type’ => ‘image’, ‘post_parent’ => $post->ID, ‘post_status’ => null, ‘post_type’ => ‘attachment’, ); $attachments = get_children( $args … Read more

Find unused images?

Is there a reliable up-to-date way to find media that resides on the server but is not used in the WP site? In short: no, not as far as I’m aware. I have found a number of plugins, but all are very old, with lots of negative comments to the effect that they do not … Read more

Front end wp_editor not rendering audio/video links

I’ve been fighting this for a while on a series of themes I make that provide a front end content creation interface not requiring a WP account. For the last two years I have said “trust me, URLs will embed”. Those old tickets are dormant, but I just have found a solution here https://wordpress.stackexchange.com/a/287623 For … Read more

How Do I Delete All The Images from WordPress

You could try the following, I havent tested it, so look out for typos or errors: $all_posts = get_posts(array( ‘numberposts’ => – 1, ‘post_status’ => ‘any’, ‘post_type’ => get_post_types(”, ‘names’) , )); foreach($all_posts as $all_post) { delete_post_media($all_post->ID); } function delete_post_media($post_id) { if (!isset($post_id)) return; elseif ($post_id == 0) return; elseif (is_array($post_id)) return; else { $attachments … Read more

Add custom setting that uses radio button to WP Gallery

I had the same problem and got it finally to work. Based on the thread you have followed, you now have to extend the “update” function of the WP core /wp-includes/js/media-views.js. Go to the “jQuery(document).ready(function()…” part of the ‘print_media_templates’ action and try this: <script> jQuery(document).ready(function() { wp.media.view.Settings.Gallery = wp.media.view.Settings.Gallery.extend({ // add your custom options template … Read more

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