Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Does anyone know how to get ID's of images from wordpress gallery in post? I have search entire internet and there is nothing to this subject.

Thx for your time :)

share|improve this question
add comment

1 Answer 1

You can find out the IDs of which images are included in a gallery by switching to the Text editor tab and look for a piece of code like this:

[gallery columns="3" link="file" ids="615,619,618,617,616"]

The comma-separated list of image IDs are enclosed in the ids attribute


If you're looking to find out IDs of existing images in order to manually create a gallery, you can visit the Media > Library admin menu and click on the Edit link under an image. In your browser's address bar, you should see something similar to the following:

http://example.com/wp-admin/post.php?post=622&action=edit

The number after post= is the image ID. In this case, the image ID is 622.

share|improve this answer
    
I don't want to search ids manually... I need some loop for it. –  Itachi Jan 8 '13 at 15:54
    
So you want to retrieve the IDs of images attached to a gallery using PHP code? –  bungeshea Jan 8 '13 at 21:46
    
I want to get images "src" so yes I want theyr id –  Itachi Jan 8 '13 at 22:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.