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

Search everything (posts, pages, tags, cpt, meta)

DeluxeBlogTips.com 1) has an article on how to do combined searches in both posts and meta data. Basically, it involves two queries via the $wpdb object; one to search the meta table to get a list of post_ids and the other is a query of posts to get post_ids. You then merge the arrays and … Read more

Categories custom-post-types Tags custom-field, custom-post-types, functions, post-meta, search

delete unused postmeta

Does the unused postmeta affect the speed of my database? Anything in your database affects the speed of your database. The question is how much of a slowdown, and if the amount of data is significant enough. Unless your having a huge amount of metadata it will not affect the speed of your database very … Read more

Categories post-meta Tags mysql, post-meta

Migrating non-WordPress CMS to WordPress, lots of data to move — possible solutions?

I would suggest inserting your tours as posts (or custom posts) and using a custom reference table with the id matching the post id of the Tour post. You could use WordPress’s built in meta box functions to be able to edit each Tour in the edit posts page. You could update your reference table … Read more

Categories Database Tags cms, database, migration, mysql, post-meta

Save HTML formatted data to post meta using add_post_meta()

Is it that your tags are being stripped, or that you aren’t preparing them prior to displaying them. Try wrapping your output: echo apply_filters(‘the_content’, get_post_meta($post->ID, ‘_custom_field_name’, true));

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

How to use multiple query with same meta key

to store multiple values in same custom field key and print them at once If you want to store it as site option, you can use update_option() : http://codex.wordpress.org/Function_Reference/update_option Example 1: // some array to store: $items=array(‘yellow’,’orange’,’green’); // save the array update_option(‘myitems’,$items); // get the array $items=get_option(‘myitems’); // print the array echo “<ul>”; foreach($items as … Read more

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

Multiple meta values for same meta_key adding on “Preview Changes” hit but not on saving or updating post

Actually I’d love to have an answer from @ialocin, because he suggested me the way. But as the code is a bit long for comment field I’m posting it here as an answer. But I’d love to accept an answer more appropriate to the situation: After @ialocin’s suggestion, I got that, the $post_id wasn’t accurate … Read more

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

WPDB Multiple site’s posts and get featured images

This is one way how to get the postmeta of the posts, by joining the postmeta table and fetching the _wp_attached_file meta value. Try this: $mydb->get_results( select a.*, thumb.meta_value from wp_posts a left join (select b.post_id, c.meta_value from wp_postmeta b, wp_postmeta c where b.meta_key = ‘_thumbnail_id’ and b.meta_value = c.post_id and c.meta_key = ‘_wp_attached_file’) as … Read more

Categories multisite Tags multisite, post-meta, query, wpdb

Detect meta value changes when post is updated (post_updated)

Like @SamuelElh comment this is how I solved it: add_action(‘updated_post_meta’, ‘check_meta_change’, 0, 4); function check_meta_change($meta_id, $post_id, $meta_key, $meta_value) { if( ‘<ENTER YOUR META KEY>’ == $meta_key ) { // do stuff } }

Categories custom-post-types Tags custom-field, custom-post-types, functions, metabox, post-meta

Manipulating post meta in the customizer

Please see the Customize Posts plugin. It has a WP_Customize_Post_Setting and WP_Customize_Postmeta_Setting for representing posts and postmeta in the customizer, respectively.

Categories customization Tags customization, post-meta, save-post, theme-customizer

Get updated meta data after save_post hook

Apparently in order to get the meta value right after saving the post, you have to either get the $_REQUEST[‘my_meta_value’] directly, or, if you need to update the database right away, you have to use update_post_meta() in your save_post action.

Categories custom-field Tags custom-field, hooks, post-meta, save-post
Older posts
Newer posts
← Previous Page1 … Page186 Page187 Page188 … Page204 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