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

Custom Post Type not showing anything added by code anymore?

It wasn’t working because at public status draft/publish were written without a capitol so it has to be ‘post_status’ => ‘Draft’ or ‘post_status’ => ‘Publish’

Categories Database Tags database, post-meta, wp-admin, wp-insert-post

Get attachment meta (I need attachment ID, unsure how to find it)

“Attachments” aren’t meta data. That is why you can’t retrieve them with get_post_meta(). “Attachments” are a post type that is attached to the parent post. You need to pull the attachment posts that have you post set as parent, and then use those IDs to get the attachment meta. $args = array( ‘post_parent’ => $post->ID, … Read more

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

Adding a meta box to determine the sidebar [closed]

Install metabox plugin and active: /**** Add this code in your function.php ****/ $meta_boxes[] = array( ‘id’ => ‘post_sidebar’, ‘title’ => ‘post Sidebar’, ‘pages’ => array(‘post’), ‘priority’ => ‘low’, ‘fields’ => array( array( ‘name’ => ‘Post Sidebar’, ‘id’ => ‘post_sidebar’, ‘type’ => ‘select’, “options” => array( “0” => “OFF”, “1” => “Left side”, “2” => … Read more

Categories posts Tags metabox, post-meta, posts, sidebar

Related posts meta_query CPT

I am assuming that what you are trying to do is something like this: $artist_name = get_post_meta(get_the_ID(), “artist_name”, true); $args = array( ‘post_type’ => array(‘songs’), ‘meta_key’ => $artist_name, ); $related = new WP_Query($args); In your question you state that you want posts that “have same value of post meta with artist name”. What the code … Read more

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

get_post_meta with WP_query

I think you may need to add global $post after the loop starts based on a similar question found here. <?php while ($queryObject->have_posts()) { $queryObject->the_post(); global $post; ?> I wish I could explain more about why, but I didn’t have time to investigate further.

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

Can’t Output get_post_meta?

Problem solved. Added the following to my function: global $post;

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

Insert data from custom created PHP page into wp_postmeta table

The error message basically says that $wpdb is not an object so you can’t call any methods on it. As we can’t see where $wpdb is defined in the source you posted it’s hard to tell any further details. Are you even including wordpress in your external file? You need to require wp-load.php to use … Read more

Categories posts Tags post-meta, posts, wp-insert-post

Hide a div when a custom field is empty

I think what you are looking for is something like: <?php $post = get_post_meta($post->ID, ‘_cmb_fe_wysiwyg’, true) ; if (!empty($post)) { ?> <div id=”ingredientsNeeded”> <h3>Ingredients</h3> <?php echo wpautop( get_post_meta( get_the_ID(), $post . ‘_cmb_fe_wysiwyg’, true ) );?> </div> <?php } ?> This will check that the value is empty and if so will hide the div

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

using update_user_meta to rank users

It looks like the plugin is using the update_post_meta function, which in turn uses the update_metadata function which includes the action hooks update_postmeta and updated_postmeta which fire immediately before and after the post meta is stored to the database. You could hook into one of these to update the user meta of the author of … Read more

Categories loop Tags loop, post-meta, user-meta

Retrieve data from post meta meta_key having ‘_product_fq_image’ while having author_id and post type is PRODUCT

To get post meta fields, you can use get_post_meta() function, but obviously not get_user_meta(), the name of the functions are self-explanatory. The first parameter of get_post_meta() function is the post ID; here you define which post you want to get postmeta from. So, you need to get frist the post ID of the post you … Read more

Categories posts Tags post-meta, posts, users
Older posts
Newer posts
← Previous Page1 … Page86 Page87 Page88 … 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