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

query_posts() on key’s value, or key’s existence

This will get you everything that doesn’t have the meta key fizzbizz. The custom loop part, I lifted directly from the codex. $pageposts = $wpdb->get_results(” SELECT * FROM wp_posts p LEFT JOIN wp_postmeta m ON p.ID = m.post_id WHERE m.meta_key <> ‘fizzbizz’ OR m.metakey IS NULL ORDER BY p.post_date DESC; “); if ($pageposts): global $post; … Read more

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

Move Post to different category if post_meta field is 0 or is 2 days old?

When you remove vote check for your condition, then if needed: fetch categories with wp_get_object_terms() (low level func, you can specify to fetch names or ids only since you don’t need full objects for this) modify array (remove category you don’t need, add the one you do) set categories with wp_set_post_categories() (it will overwrite all … Read more

Categories functions Tags functions, post-meta

Access post meta in future_to_publish function

Hi @epaps: So I tested your code and it all works fine. The $post is passed in as an object and you have full access to the $post->ID variable. Best I can tell is that you have some kind of plugin interaction that is causing it to fail or that, for some reason the scheduled … Read more

Categories customization Tags customization, functions, post-meta

Post image in WordPress not appearing on home page

You are almost there you just need to call it inside your theme file say in your index.php inside the loop somewhere between <?php while ( have_posts() ) : the_post(); ?> /// /// <?php endwhile; // End the loop. ?> you need to add a call for that image using get_post_meta() like this: <?php while … Read more

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

What is generating my meta og:description?

The Facebook Page Publish plugin is adding the og:description. Looking through the code in fpp_index.php at lines 843 – 851: $description = array(); if ($options[‘show_post_author’]) { $description[] = esc_attr(fpp_get_post_author($post));/*, ENT_COMPAT, ‘UTF-8’)*/ } if ($options[‘show_post_categories’]) { $categories = esc_attr(fpp_get_post_categories($post));/*, ENT_COMPAT, ‘UTF-8’)*/ if (!empty($categories)) $description[] = $categories; } echo ‘<meta property=”og:description” content=”‘.implode(‘ | ‘, $description).'”/>’; It appears … Read more

Categories plugins Tags excerpt, facebook, plugins, post-meta

Display All Custom Post Fields and Values, Unless Empty

This can easily be done with default PHP functions. // Loop through all fields, grab the content and assign it to a new array foreach ( get_post_custom() as $custom ) $new_custom[] = array_shift( $custom ); // Get rid of empty fields $new_custom = array_filter( $new_custom );

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

update_post_meta, xml parser

Maybe if you use add_post_meta instead, because update_post_meta assumes that you have already that value and you are updating it ( from http://codex.wordpress.org/Function_Reference/update_post_meta ). Also check if $doc->prod[$i]->awImage is actually a string (do print_r instead of echo).

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

MySQL Query To Select Post By Postmeta

If I understand the question you are trying to show both post on single.php something like this should work as a second loop. Put This INSIDE the first loop. Do this so you can get the current post ID $parent_id=the_ID(); // Second Loop $query = new WP_Query( array ( ‘post_type’ => ‘TYPE1’, ‘meta_key’ => $parent_id … Read more

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

Custom field not updating when value is empty

You are checking if the field is empty. Try to update it if its empty as well if( trim( $attachment[ $field ] ) == ” ) $post[ ‘errors’ ][ $field ][ ‘errors’ ][] = __( ‘Error! Something went wrong.’ ); else update_post_meta( $post[ ‘ID’ ], $key, $attachment[ $field ] ); Try if( isset( $attachment[ $field … Read more

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

Query_post($args)

Refer to multiple custom field handling in WP_Query: $args = array( ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘city_1’, ‘value’ => array(‘NY’,’LA’), ‘compare’ => ‘IN’ ), array( ‘key’ => ‘city_2’, ‘value’ => array(‘NY’,’LA’), ‘compare’ => ‘IN’ ) ) ); query_posts($args);

Categories query-posts Tags post-meta, query-posts
Older posts
Newer posts
← Previous Page1 … Page139 Page140 Page141 … 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