Where is the path of the images of posts in Wordpress stored?

3

I'm putting together a custom cakephp plugin, because the plugin of the wordpress itself does not work, until then, I was able to use everything from the wordpress posts table, the problem is that I do not know where the path of the images of the posts is. Thank you in advance.

    
asked by anonymous 17.11.2015 / 17:20

1 answer

3

Files are in wp-content/uploads/

In the database:

The highlighted images are saved in the postmeta table with meta_key _wp_attached_file and related to meta_key of _thumbnail_id

The images within the post has the name saved in the posts table together with the content in post_content

An example query to list the posts with the highlighted image is:

select *, (select p.guid from wp_postmeta pm, wp_posts p where pm.meta_key="_thumbnail_id" and pm.post_id=post.id and p.ID=pm.meta_value) as imagem_destacada from wp_posts post where post_status='publish' and post_type="post";
    
17.11.2015 / 17:28