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

Metadata in loops

get_post_meta() function works In and Outside of the loop and you saying that you do see it working on a single image “but doesn’t in loop” means that you probably did not add the code to the right loop. To be clear It works with all posts types.

Categories metabox Tags loop, metabox, post-meta

Why values dont shows in custom post column?

add_action( ‘manage_post_custom_column’, ‘price_column_display’, 10, 2 ); This line is wrong. I think it should be: add_action( ‘manage_catalog_post_custom_column’, ‘price_column_display’, 10, 2 ); The hook format is as follows: manage_{$post_type}_posts_custom_column EDIT: try your custom column code like the following code. I know in this format it works: add_action(‘manage_stores_posts_custom_column’, ‘sc_stores_manage_columns’, 10, 2); function sc_stores_manage_columns($column_name, $id) { $custom = … Read more

Categories post-meta Tags columns, post-meta

If post custom meta data is not set, show normal state

To get a value of a single custom field use <?php $post_id = $post->ID; $key = ‘value’; // change value to what custom field you are looking for // To retrieve only the first value of given key $customfield = get_post_meta($post_id, $key, ‘true’); // To use as default $customfield = get_post_meta($post_id, $key); // Then check … Read more

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

WordPress User Frontend Editing Custom Fields

this line: $post_cf = update_post_meta($post->ID,’location’,$post_location); $post->ID isn’t set in this context, you want to pass $_POST[‘post_id’] I assume.

Categories plugins Tags custom-post-types, front-end, php, plugins, post-meta

get_children filter with postmeta

This should do the trick: global $wpdb; $parent = 1; // Make sure it’s int (intval() it) as it’s not escaped in the query $posts = $wpdb->get_results( “SELECT `post_id` AS `ID`, `meta_value` AS `Progress` FROM {$wpdb->postmeta} WHERE `meta_key`=’task_progress’ AND `meta_value` < 100 AND `ID` IN (SELECT `post_id` FROM {$wpdb->posts} WHERE `post_parent`={$parent}) ORDER BY `meta_value` DESC, … Read more

Categories post-meta Tags post-meta

Add meta tags with a plugin?

For anyone using Thematic, the thematic_create_description() filter worked nicely.

Categories plugins Tags homepage, plugins, post-meta

Custom post type – update_meta not working

OK, this was actually a problem with another plugin. When using more than one Custom Post Type and the save_post action, a wp_nonce should be used to verify which plugin the action is actually coming from. Without this, all of my CPTs were trying to fire this CPT’s save_post action which consequently broke all of … Read more

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

Display post_meta in Shortcode

Looks like you’ve got two issues: The first is your use of $q->ID. This is not the correct way to get the current post id from inside a loop. You want to use get_the_ID(). The second issue is you should be using get_bloginfo() instead of bloginfo(). Bloginfo echo’s the data directly while get_bloginfo() returns it … Read more

Categories shortcode Tags post-meta, shortcode

Export posts with postmeta without ID?

Instead of exporting raw SQL, instead us eth eWordPress exporter and import them that way. This way any media attachments, taxonomy terms, and post meta are all included, and all URLs are adjusted too

Categories post-meta Tags export, mysql, phpmyadmin, post-meta

Custom fields / meta box output

You can use get_post_meta() function to retrieve values of fields. Example : To retrieve the value of date metabox use following code. get_post_meta(get_the_ID(), ‘date’, true);

Categories custom-field Tags custom-field, post-meta
Older posts
Newer posts
← Previous Page1 … Page15 Page16 Page17 … 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