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

Identifying Importer Posts

Two things I could imagine: Check the post_modified value. Maybe import creates a definitive timestamp that you could use. You’ll still have to save the import date somewhere so you can check against it. I do some post importing via a stream/HTTP response (this is not the native importer). During the import, I map my … Read more

Categories post-meta Tags bulk-import, import, post-meta

Are multiple values from get_post_meta guaranteed to be ordered?

Yes. get_post_meta() uses get_metadata() which in turn uses update_meta_cache() to retrieve the values. In the source code we see this part (comment mine) // $id_column is ‘meta_id’ $meta_list = $wpdb->get_results( “SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list) ORDER BY $id_column ASC”, ARRAY_A ); So the meta values will be ordered by meta_id … Read more

Categories post-meta Tags post-meta

How to add meta tag to wordpress posts filter?

There is not a standerized way to add HTML meta tags in WordPress but you can use wp_head action as a generic way to add meta tags. I think description meta tag should not be in the theme, as you suggest in your answer, because description meta tag is a property of the document, nothing … Read more

Categories post-meta Tags description, post-meta

Get posts by meta value with date

Depends what you are getting back from the ‘date_event’ post-meta field. That’s probably the culprit here — if it’s an actual date with a month and day, it’s not going to match what you are getting from date(‘Y’), which is just going to be ‘2018’. You can check the value in ‘date_event’ on any of … Read more

Categories post-meta Tags date, get-posts, post-meta

loop through all meta keys with get_post_meta

As @Sally CJ noted in the comment to your question, you should just omit the meta key: $meta = get_post_meta( $post->ID, ”, true ); echo $meta[‘car_year’]; // 2005 In PHP 7.1 you can use array destructing: [ ‘image_meta’ => $image_meta, ‘car_year’ => $car_year, ‘car_mileage’ => $car_mileage, ‘car_price’ => $car_price, ‘car_model’ => $car_model, ] = get_post_meta( … Read more

Categories post-meta Tags post-meta

update_post_meta not adding anything.(Nor add_post_meta)

Found the solution in this post: update_post_meta and update_field ony working when saving the post The solution is to use update_field because update_post_meta uses a different method to update fields than ACF does. Do note that this is the correct order of using the code update_field($meta_key, $meta_value, $post_ID);.

Categories post-meta Tags post-meta

Adding meta data to an attachment post

So since attachments are post types, you should be able to assign them postmeta like any other post type. Using the update_post_meta function should get you where you need to be. update_post_meta( $attachment_id, ‘price’, $price ); http://codex.wordpress.org/Function_Reference/update_post_meta Then run your query based on a meta key. $args = array( ‘order’ => ‘ASC’, ‘post_type’ => ‘attachment’, … Read more

Categories post-meta Tags attachments, post-meta

get_post_custom()

What qualifies as custom field? Yes, a custom field is equal to post metadata, but be aware that some metadata is only for internal use (usually prepended with an underscore, for example _edit_lock. A more detailed look at the function The function get_post_custom() is actually just a wrapper for get_post_meta(): (wp-includes/post.php line 1764), but with … Read more

Categories post-meta Tags post-meta

Triple meta_key on custom SELECT query

Your Query is incorrect. To retrive meta values for triple meta_key you will need 3 different joins using posts meta on posts table. Check code below: // Example value $user_id = 1; // Calculate average post rating for user $ratings_query = $wpdb->get_results( $wpdb->prepare(” SELECT pmeta.meta_value FROM wp_posts LEFT JOIN $wpdb->postmeta AS pmeta ON (pmeta.post_id = … Read more

Categories post-meta Tags mysql, post-meta, select, wpdb

Using Advanced Custom Field (ACF) to insert meta description on each page

As mentioned in the comments, you are outside of the loop, so get_field will not know the ID. You can use the code below: <?php $meta_description = get_field(‘meta_description’, get_queried_object_id()); if(empty($meta_description)) { $meta_description = ‘This could be an interesting meta description’; } ?> <meta name=”description” content=”<?php echo $meta_description; ?> “/> If you use var_dump() in the … Read more

Categories post-meta Tags advanced-custom-fields, post-meta
Older posts
Newer posts
← Previous Page1 … Page43 Page44 Page45 … Page51 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
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 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