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

Can’t save meta field value if the title not set

Can’t save meta field value if the title not set

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

Search one custom field?

Assuming you are using post_meta this should help:: $color=”red”; $the_query = new WP_Query(array( ‘meta_key’ => ‘color’, ‘meta_value’ => $color ));

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

Access post meta just after publishing

Here is the description of transition_post_status from the codex: This function’s access is marked as private. That means it is not intended for use by plugin and theme developers, but only in other core functions. It is listed here for completeness. Use any of these functions instead. Why not use the publish_post action instead? There … Read more

Categories hooks Tags hooks, post-meta, publish

Problem serializing single quote and double quote into post meta

Problem serializing single quote and double quote into post meta

Categories post-meta Tags post-meta

What is the best way to query posts based on live data?

you must implement logic for edge cases, you could get the posts and check when was the last time their rate meta was updated! depending on that you decide if you can display or not the post on your search result

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

Get meta value when the page is a blog archive

get_queried_object_ID() will return the ID on the page for posts, or get_queried_object() will return the page object containing all its post fields. Alternately, the ID of the blog page is stored in the option page_for_posts, which is internally how get_queried_object gets the ID of the post object to load.

Categories custom-field Tags archive-template, custom-field, loop, metabox, post-meta

Echo out custom fields in comments

There is no comment_ID until you are in the foreach loop. Try: $comments = get_comments($args); foreach($comments as $comment) : echo ‘<div id=”‘ . $comment->comment_ID . ‘”>Agent Name ‘ . $comment->comment_author . ‘Phone’ . $comment->comment_phone . ‘Reply’ . $comment->comment_content . ‘</div>’; echo get_comment_meta( $comment->comment_ID, ‘agents_condition’, true ); endforeach;

Categories custom-field Tags comment-form, comment-meta, comments, custom-field, post-meta

How can I get the $key / $value pairs of custom fields that were added via 3rd party plugins or themes?

How can I get the $key / $value pairs of custom fields that were added via 3rd party plugins or themes?

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

Update post_meta post_name with the post ID from wp_insert_post after user register

No need for the two functions/hooks – just use the first, with the addition of: if ( $post_id = wp_insert_post( $user_page ) ) { wp_update_post( array( ‘ID’ => $post_id, ‘post_name’ => $post_id, ) ); }

Categories wp-insert-post Tags post-meta, save-post, user-registration, wp-insert-post

Check if value exists before saving

$havemeta = get_user_meta($user_id, ‘billing_cpf’, false); if ($havemeta) // do something } else { // do something } Try This

Categories custom-field Tags custom-field, post-meta, woocommerce-offtopic
Older posts
Newer posts
← Previous Page1 … Page34 Page35 Page36 … 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