how to get random media id from media gallery

You can use get_posts() function to get random post, without additional php manipulation. Just change default orderby attribute to “rand” and set number of posts attribute equals to “1”. $image = get_posts( array( ‘orderby’ => ‘rand’, //random order ‘numberposts’ => 1, // numberposts, not posts_per_page ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘post_status’ => ‘inherit’ ) … Read more

Why does WP allow to view and media item as a page

It is desirable because you can modify that page, to introduce extra functionality. e.g.: Comments Meta data custom fields titles descriptions Image EXIF showing geolocation data video/audio players thumbnails of other images attached to the post, e.g. the other pictures in the gallery If it troubles you, you can ‘remove’ the feature, by making an … Read more

Resize existing library images

Doing this on your own is actually quite a lot of work. For the sole purpose of regenerating your custom image sizes I would recommend using this plugin: AJAX Thumbnail Rebuild It allows you to loop through your Image Library and regenerate the different image sizes that you selected.

wp_editor add media button not working

I will assume that you are creating a custom admin page at ?page=add-quiz, in this case before calling the wp_editor function you also have to enqueue the CSS / Js files for it with the wp_enqueue_media() function. So at the end you should have wp_enqueue_media(); wp_editor( ”, ‘instructions’, $settings = array(‘textarea_name’ => ‘instructions’, ‘textarea_rows’ => … Read more

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