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

How to get all term meta for a taxonomy – getting term_meta for taxonomy

You’re using $term->ID. Taxonomy terms do not have an ID property. They have a term_id property: $display_type = get_term_meta( $term->term_id ); You’ll notice that WooCommerce is using this, while your attempts are not.

Categories post-meta Tags meta-value, post-meta, terms, wpdb

How to update/delete array in post meta value?

To update post meta that are an array: you have to fetch the original values, change the value you need and update it again. For example $list_of_values = get_post_meta($post_id, ‘_list_values’, true); if(!empty($list_of_values)) { $list_of_values[“some_prop”] = “new value”; } update_post_meta($post_id, ‘_list_values’, $list_of_values);

Categories post-meta Tags post-meta

Is there a hook / action that is triggered when adding or removing a post thumbnail?

I think you want to use the added_post_meta hook instead of updated_post_meta because you’re not updating the meta here, only adding it. At least in the case of the _thumbnail_id, where we must delete it before adding it again (no update) through the admin UI. Investigating this further we see that this part of the … Read more

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

How Can I save multiple records in same meta key?

This should work out of the box, as long as the “unique” parameter of add_post_meta() is false. add_post_meta($id, ‘_dates’, 2, false); add_post_meta($id, ‘_dates’, 3, false); add_post_meta($id, ‘_dates’, 4, false); then somewhere else $dates = get_post_meta($id, ‘_dates’, false); Now $dates should be an array of your 3 values.

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

How to create a mini directory in WordPress?

Sounds like what you want is to use Custom Post Types with custom fields to create your own directory. Here’s an answer I wrote about exactly that: Tips for using WordPress as a CMS? Implementing a CrunchBase.com Clone using WordPress? Also, take a look at the SimpleFields plugin for WordPress which can help you create … Read more

Categories custom-post-types Tags custom-post-types, directory, post-meta

Post metadata deletes itself

I’ve been using this for a while to solve exactly your issue, I think I got it from the codex somewhere. But it works. // verify if this is an auto save routine. // If it is our form has not been submitted, so we dont want to do anything if ( defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE … Read more

Categories custom-post-types Tags custom-post-types, post-meta

How to delete outdated, wrongly sized images in _wp_attachment_metadata?

Not from personal experience (I don’t use WP image management much), but I believe Regenerate Thumbnails plugin is usually recommended for rebuilding thumbnails.

Categories Database Tags customization, database, images, post-meta

How to programmatically create a connection with [Plugin: Posts 2 Posts] on cpt publish?

Just call p2p_connect( $id_of_post_type_a, $id_of_post_type_b ); in the form handling code.

Categories custom-post-types Tags custom-post-types, plugin-posts-to-posts, post-meta, publish

How to batch update post content with custom post meta value

what about something like this on activation? function wpa47153_run_once(){ $posts = get_posts(array(‘numberposts’ => -1) ); foreach($posts as $p) : $meta = get_post_meta($p->ID, ‘meta_key’,true); if($meta) : $my_post = array(); $my_post[‘ID’] = $p->ID; $my_post[‘post_content’] = $meta . “<br/>” . $p->post_content ; // Update the post into the database wp_update_post( $my_post ); unset($my_post); //remove the meta key delete_post_meta($p->ID, … Read more

Categories posts Tags metabox, post-meta, posts, updates, wp-update-post

Why is get_post_meta returning an array when I specify it as single?

This works fine if I’m only returning data for a single meta key…but fails if I want to return all of the meta data, but return them all as strings (single). This doesn’t make a lot of sense. A function in PHP can only return a single value so there is no way to return … Read more

Categories post-meta Tags post-meta
Older posts
Newer posts
← Previous Page1 … Page187 Page188 Page189 … 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