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 posts based on post meta data

DELETE wp_posts FROM wp_posts INNER JOIN wp_postmeta ON wp_postmeta.post_id = wp_posts.ID WHERE (wp_postmeta.meta_key = ‘InternalOnly’ AND wp_postmeta.meta_value IS NOT NULL);

Categories post-meta Tags post-meta

Why do I have to press the “Update” button twice to save my meta box values?

The issue is that you are using get_post_meta(), but since you’re hooking wp_insert_post_data you have not set the post meta yet (because the hook fires before the post is inserted into the database. You should be pulling from the metadata submission, and running through any filters you use for update_post_meta(). If you post the code … Read more

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

How to make wordpress nav menu use post custom meta data

You need a custom walker. Change the function function start_el() to use your custom field’s value.

Categories menus Tags menus, navigation, post-meta

How do i get the attached images with custom value checked?

<?php $args = array( ‘post_type’ => ‘attachment’,***’meta_key’=>’your meta key’,’meta_value’=>’your meta value’,*** ‘numberposts’ => -1, ‘post_status’ => null, ‘post_parent’ => $post->ID ); $attachments = get_posts($args); if ($attachments) { foreach ( $attachments as $attachment ) { echo apply_filters( ‘the_title’ , $attachment->post_title ); the_attachment_link( $attachment->ID , false ); } } ?>

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

How to use media upload on metabox post page without breaking TinyMCE?

I was looking at this answer earlier. It shows you how to remove fields from the Media Uploader, so maybe it’ll set you on the right lines for writing an additional function to incorporate into the Uploader?

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

is there an update_post_meta action

(See codex) update_post_meta() calls update_metadata(‘post’, $post_id, $meta_key, $meta_value, $prev_value); This function is here. And there are plenty of hooks/filters: (In example of ‘post’, $meta_type=”post”) Before metadata is updated: update_{$meta_type}_metadata (here) Filter –If this returns anything other than ‘null’, the metadata won’t save update_{$meta_type}_meta (here) Action After metadata is updated: updated_{$meta_type}_meta (here) Action updated_post_meta (here) Action … Read more

Categories actions Tags actions, post-meta

How to move a post to different post type with all meta data?

As has been mentioned in the comments – changing the post type of a post only changes its ‘post type’ column. All post metadata is associated with the post ID and this never changes. However, you may not see this information: if the old post type had a metabox or taxonomy associated with that, that … Read more

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

Sort custom posts in archive by multiple values: date AND meta key

You have syntax error in query arguments: ‘orderyby’.

Categories post-meta Tags custom-post-type-archives, order, plugin-wp-pagenavi, post-meta, sort

Hide custom fields when empty

There are a few issues that break your code: $post doesn’t exist, you’d need to import it using global, or simply use get_the_ID as you’re already doing $check[”] won’t return anything since it will access an undefined index, outside of the empty construct it would trigger a warning I can’t test it right now, but … Read more

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

Exclude posts by post meta value

$args = array( ‘meta_key’ => ‘home_post_id’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘DESC’, ‘meta_query’ => array( array( ‘key’ => ‘home_post_id’, ‘value’ => 0, ‘compare’ => ‘>’, ‘type’ => ‘numeric’, ) ) ); query_posts($args); Something like this should work but I haven’t tested it .) Let me know if it works.. Reference: WP_Query – Custom Field Parameters

Categories query-posts Tags exclude, post-meta, query, query-posts
Older posts
Newer posts
← Previous Page1 … Page105 Page106 Page107 … 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