$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Number of Style for Image Added into Post|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Number of Style for Image Added into Post

matteradmin9PV0评论

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.

Share Improve this question edited Jan 19, 2019 at 20:18 Brethlosze asked Jan 19, 2019 at 20:06 BrethloszeBrethlosze 1491 gold badge2 silver badges11 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

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.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far