Show ids of displayed media library items

Actually, wordpress stores the media library files also as a post format. so you can follow this way to get your attachment media file and their id’s. Hope this will help you. function get_images_from_media_library() { $args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ =>’image’, ‘post_status’ => ‘inherit’, ‘posts_per_page’ => 5, ‘orderby’ => ‘rand’ ); $query_images = … Read more

How to get any tag ID

In your admin, go to Posts > Tags and then click edit for the tag you’re after – the URL in your browser address bar will look like: http://example.com/wp-admin/edit-tags.php?action=edit&taxonomy=post_tag&tag_ID=X&post_type=post See the part where tag_ID=X – that X is your tag ID.

$post->ID displays wrong ID

On that page $post->ID returns the ID of first blog post for given page. That is how it works. $post is set to the first post in the Loop. On single posts and pages that is the same as the post or page. On archive pages it is the first post in the result set. … Read more

get all page IDs from wp_list_pages

wp_list_pages() is for formatted markup. Use get_pages() and wp_list_pluck(): $pages = get_pages( array ( ‘parent’ => 0, // replaces ‘depth’ => 1, ‘exclude’ => ‘3,5,11’ ) ); $ids = wp_list_pluck( $pages, ‘ID’ ); $ids holds an array of page IDs now.

Are all ID’s used unique?

If you look at the description for the different tables used by WordPress, the columns described as “auto_increment” will be unique. I am not sure what you are doing though. The URL structure you are using is not one that I recognize. That is, the syntax I think you want is this: example.com/?p=1774 rather than … Read more