Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

post-meta

Save camera info as metadata on image upload?

You can use wp_generate_attachment_metadata: This function generates metadata for an image attachment. It also creates a thumbnail and other intermediate sizes of the image attachment based on the sizes defined on the Settings_Media_Screen. The second argument of the filter is the attachment ID, so it shouldn’t be a problem to add the post meta: add_filter( … Read more

Categories uploads Tags post-meta, uploads

What is the different between an attachment in wp_posts and an attachment in wp_postmeta?

An attachment is a Post The posts table contains information on the attachment post. In WordPress every uploaded media has it’s own post entry, where post_type is ‘attachment’ and post_status is ‘inherit’. In fact, you can get attachment post types using functions used to get other post types, like post, page or any CPT. That … Read more

Categories post-meta Tags attachments, post-meta, woocommerce-offtopic

The “_encloseme” Meta-Key Conundrum

Short version: _encloseme is added to a post when it’s published. The wp-cron process should get scheduled shortly thereafter to process the post to look for enclosures. In other words, it cleans them up normally later. Nothing to worry about. Full explanation: “Enclosures” are links in a post to something like an audio or video … Read more

Categories custom-field Tags custom-field, post-meta

WordPress retrieving meta data for all custom post types in list view

Try changing hierarchical: false in your CPT definition (if your application allows). When CPT’s are set to hierarchical: true all posts will be queried in the admin dashboard which can cause memory issues.

Categories wp-query Tags list, post-meta, wp-query

How to use update_{$meta_type}_metadata filter to modify meta value

The code snippet in question is: $check = apply_filters( “update_{$meta_type}_metadata”, null, $object_id, $meta_key, $meta_value, $prev_value ); if ( null !== $check ) return (bool) $check; This filter only allows you to prevent the updating of the metadata for a given type, not to explicitly change the metadata itself. If you want to use this filter … Read more

Categories filters Tags filters, post-meta

What’s the point of get_post_meta’s $single param?

In general, storing PHP serialized data in database in a bad idea. It can be easily understood if you use multple key-value pairs of data in one field row, that is, you use an array or a object with one meta key. Imaging a car as the object. You can set multiple meta values to … Read more

Categories post-meta Tags post-meta

How to enable revisions for post meta data?

I’m sorry, but for now there is no easy way to “enable” revisioning of postmeta. However, you can add post metadata to revisions. A guy named John Blackburn wrote a pretty good article about adding post metadata to revisions. You find it here: https://johnblackbourn.com/post-meta-revisions-wordpress

Categories custom-field Tags custom-field, post-meta, revisions

Filtering posts by post meta data

The WP_Query object accepts a post meta argument. Generally speaking you want to do the following: $my_query = new WP_Query( array( ‘post_type’ => ‘post’, ‘meta_query’ => array( array( ‘key’ => ‘project_cat’, ‘value’ => ‘my-value’, ) ), // Other query properties ) ); Where ‘my-value’ is your ‘specified value’. Example usage: add_action( ‘pre_get_posts’ , ‘my_pre_get_posts’ ); … Read more

Categories query-posts Tags post-meta, query-posts

Adding meta tag without plugin

Although I would advice you to avoid this and use a plugin for this work. Because only a dedicated plugin can help SEO. “WordPress SEO” from yoost is a great plugin for SEO. That being said, here is the code for adding meta description and keywords in header. Paste this in theme’s functions.php file. function … Read more

Categories post-meta Tags post-meta, seo

How to add category to: ‘wp-admin/post-new.php’?

Dave James Miller over at GitHub nailed this one for me. None of the work is from me, I’m just posting his code wrapped into a plguin since it works perfectly as advertised: <?php /** * Plugin Name: Set default category from url parameter * Plugin URI: https://gist.github.com/davejamesmiller/1966543 * Description: enables you to setup new … Read more

Categories posts Tags categories, post-meta, posts, rest-api, urls
Older posts
Newer posts
← Previous Page1 … Page197 Page198 Page199 … Page203 Next →
+ More

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
Next Page »
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress