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

delete value 0 in post meta [closed]

This question is off-topic because your is a simple PHP error, not related to WordPress. You are trying to check if a variable is empty using: if ( $meta != $empty ) { but this is not the right way, in fact this code compare the target variable $meta with another variable $empty that is … Read more

Categories post-meta Tags post-meta

get_post_meta – get a single value

If every meta value has the key f_name $meta = get_post_meta($post->ID, “company_wp_box_g”, true); echo $meta[‘fname’]; If you’re not sure of the contents & want to search for the first one available $name = false; $meta = get_post_meta($post->ID, “company_wp_box_g”, false); foreach($meta as $array) { if(isset($array[‘f_name’])) { $name = $array[‘f_name’]; break; } } echo $name;

Categories post-meta Tags post-meta

Why am I getting an infinite loop with have_posts?

Look at this answer: get custom post type by tag I believe you’d use $flagged_stores->the_post() inside while loop.

Categories post-meta Tags loop, post-meta, recursive

List posts under meta_value heading

You should use some of WordPress’s built in functions, there is even a new meta compare parameter. You can create, for example: $state = get_post_meta($post->ID, ‘meta_state’, true); //the meta value to compare $query = new WP_Query ( array( ‘meta_key’ => ‘project’, ‘meta_value’ => ‘$state’, ‘meta_compare’ => ‘<=’, ‘post_type’ => ‘projects’ ) ); //spit them out … Read more

Categories post-meta Tags list, post-meta

Clean up output added via wp_head()

You can remove some of the header stuff with the following. // remove unncessary header info function remove_header_info() { remove_action(‘wp_head’, ‘rsd_link’); remove_action(‘wp_head’, ‘wlwmanifest_link’); remove_action(‘wp_head’, ‘wp_generator’); remove_action(‘wp_head’, ‘start_post_rel_link’); remove_action(‘wp_head’, ‘index_rel_link’); remove_action(‘wp_head’, ‘adjacent_posts_rel_link’); } add_action(‘init’, ‘remove_header_info’); The default installation does not include stuff like meta keywords, so that is either a theme or plugin that you are … Read more

Categories post-meta Tags functions, headers, post-meta, seo

WP REST API “rest_no_route” when trying to update meta

Here is what I have learned about the WP REST API: It is a mess of undocumented and unfinished code with great promise but frustratingly little clarity. That said, I have a workaround that I will post here, hoping it is useful to others in a similar pickle to me: I just found that I … Read more

Categories post-meta Tags post-meta, rest-api

How to get meta value in wp_attachment_metadata

There are two methods: get_post_meta() $attachment_meta = get_post_meta( $post->ID, ‘_wp_attachment_meta’, true ); Will return an array(): $width = $attachment_meta[‘width’]; That true as the third parameter is especially important in this case, since the metadata being queried is a serialized array. You need to return it as single, or you’re going to get an array returned, … Read more

Categories post-meta Tags attachments, images, post-meta

Give extra post-meta to RSS feeds

WordPress uses SimplePie for reading feeds, not for generating feeds. You’re looking at two different things here: You want to output your custom post meta in an RSS feed. You want to read that custom post meta somewhere else. The first part is pretty easy. WordPress supports custom RSS feed templates. You can actually replace … Read more

Categories post-meta Tags post-meta, rss, simplepie

Get Advanced Custom Fields values before saving [closed]

Edit – This answer is no longer accurate for the current version of ACF, see their documentation Use the acf_save_post hook. function my_acf_save_post( $post_id ) { // vars $fields = false; // load from post if( isset($_POST[‘fields’]) ) { $fields = $_POST[‘fields’]; } // … } // run before ACF saves the $_POST[‘fields’] data add_action(‘acf_save_post’, … Read more

Categories post-meta Tags advanced-custom-fields, post-meta

Save both current and new version of post meta

that could be caused by post revision being saved, and you should use wp_insert_post_data anytime you want to do something before the post is saved, here is an example plugin i just cooked up to test it and it looks like this: <?php /* Plugin Name: wpse37901 Plugin URI: http://en.bainternet.info Description: answer to http://wordpress.stackexchange.com/questions/37901/save-both-current-and-new-version-of-post-meta Version: … Read more

Categories post-meta Tags duplicates, post-meta
Older posts
Newer posts
← Previous Page1 … Page45 Page46 Page47 … Page51 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