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

remove a single post_meta

I’d say there is barely enough information in the question to speculate on an answer but it sounds like to me that… If your data is saved in individual key/value pairs then delete_post_meta will do it. You would pass the function a post ID and a key name: delete_post_meta(1,’keyname’);. It will delete the whole key/value … Read more

Categories metabox Tags customization, metabox, post-meta

Query posts by searching for a string in a meta field

First of all – I assume the $search variable is being populated from $_GET (it’s not in your code). Secondly, do you need the % ? I think using LIKE with wp_query doesn’t require them.

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

Getting WordPress to store 0 values for custom post type meta

When using the == comparison, it compares the values at the same type. So 1 is equal to “1”, and true. Likewise, 0 is equal to false. Taking a deeper look into the return values of get_post_meta, we can see that using the $single=true 3rd argument returns a blank string (”) when no value is … Read more

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

Image not showing using a custom function and get_post_meta

UPDATE Ok, thanks to all for helping me out and pointing me in the right direction. I do have some code clean up to do and a possible all out change in code but I’ll use this for now. I got it to work with the following code. //El display image function el_display(){ global $post; … Read more

Categories images Tags images, metabox, post-meta

How to add post meta to post permalink with still keeping a good performance?

Your code is setting the slug of the post to your custom meta string. That work is done on the admin side and so shouldn’t effect your viewers much. WordPress will use that slug more or less directly to construct an url and/or load a page. What you have done is not different from hand-writing … Read more

Categories permalinks Tags performance, permalinks, post-meta

Front end update_post_meta Help

your nonce action name is wrong use same as entered in wp_nonce_field(‘update_grn_data’,’grn_data’); and also you forget to echo nonce, try this if ( isset( $_POST[‘grn_data’] ) && wp_verify_nonce($_POST[‘grn_data’],’update_grn_data’) ) { //if nonce check succeeds. $postid = $_POST[‘post_id’]; $data = $_POST[‘grn’]; update_post_meta($postid,’grn’,$data); } form <?php /* This file is to provide input fields to record data … Read more

Categories forms Tags forms, front-end, post-meta, save-post

Search CPT Title AND Meta

It seems you are only searching the meta with $search. You need to also pass $search to s. $args[‘s’] = $search Here’s a similar question. Search that will look in custom field, post title and post content

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

Simple Custom Metabox Not Saving

This is because save_post hook function accepts post id as parameter and not post object so the save_custom_meta function should be as following. /** Save the Data **/ function save_custom_meta($post_id) { // verify nonce if (!wp_verify_nonce($_POST[‘shortdesc_meta_box_nonce’], basename(__FILE__))) return $post_id; // check autosave if (defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE) return $post_id; // check permissions if (!current_user_can(‘edit_post’, $post_id)) return … Read more

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

saving/reading custom field value does not work – no value gets POSTed

You have two issues: 1.- Your are not passing the correct post ID. To solve this problem change: update_post_meta( $post->ID, ‘my_key’, $mydata ); To: update_post_meta( $post_id, ‘my_key’, $mydata ); 2.- Your are not createing the input correctly, the name attribute is missed: Change: echo ‘<input type=”text” value=”‘ . $value . ‘” id=”my_id”>’; To: echo ‘<input … Read more

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

HM CMB: Post Select Field for CPT ID

Unfortunately it is not possible to modify the field to use the name instead of ID and to keep the AJAX functionality. You could use a standard select field, and pass the post data in the desired format to this – although you will loose the AJAX functionality. The only way to achieve 100% of … Read more

Categories custom-post-types Tags custom-post-types, post-meta, query-posts
Older posts
Newer posts
← Previous Page1 … Page82 Page83 Page84 … 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