When adding an image through the GUI, an HTML
element is created:
<img src=".jpg"
alt="leaf graphic"
title="leaf graphic"
class="alignright size-medium wp-image-3109"
height="25" width="30"/>
A sequential 3109
and a style name wp-image-3109
(?) is generated.
Besides, I cannot find it in any table in the DB (wp_posts
, wp_postmeta
or any other table).
How the next ID must be generated? Is there a WP PHP function returning it?
Thanks in advance.
When adding an image through the GUI, an HTML
element is created:
<img src="http://example/images/leaf.jpg"
alt="leaf graphic"
title="leaf graphic"
class="alignright size-medium wp-image-3109"
height="25" width="30"/>
A sequential 3109
and a style name wp-image-3109
(?) is generated.
Besides, I cannot find it in any table in the DB (wp_posts
, wp_postmeta
or any other table).
How the next ID must be generated? Is there a WP PHP function returning it?
Thanks in advance.
I’m not sure if I understand your question correctly, but...
In WP any attachment is a post (of attachment type). So 3109 is ID of that post.
This means, that if you’ll take a look at wp_posts table, then you should find that post and there should be some additional info stored as meta fields in wp_postmeta table (for example sizes of all generated images are stored as meta).
So the ID of next uploaded image will be the next value of ID column in wp_posts table.