Get featured image url
To get the featured image URL from a WordPress post you first have to be clear which URL you should have. There are multiple sizes of the image available. The default size is “post-thumbnail”, but you can also get the “small”, “medium” and “large” sizes, or custom sizes added by add_image_size(). Use the following function […]
SQL query delete post and postmeta by meta key and value
To delete all posts by a specific meta key and optionally meta value I run the following SQL query:
SQL delete orphaned post meta data
When using lots of plugins and different themes or when testing your own custom made theme or plugin, a lot of post meta can remain in your database that is not linked to a post. By applying the following query to your database, you can delete all meta data that is no longer linked to […]
Get page ID by template
A useful functionality in WordPress is the use of page templates. This allows you to create custom made template that you specifically link to a specific page. Sometimes it is useful to check which pages are attached to this template. For example, if you want an overview of exactly those pages or if you want […]