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

How to store Gutenberg ColourPicker RGBA as metadata

How to store Gutenberg ColourPicker RGBA as metadata

Categories post-meta Tags block-editor, color-picker, post-meta

Post IDs missing on delete_postmeta action hook

From the OPs edit moved to an answer. I found an answer, also not a straight path, I’m sure there’s a better way to do this. basically I use a little helper method that queries the SQL with the meta_id and return the post_id: <?php function get_key_by_id( $meta_ids ) { global $wpdb; $meta_ids = absint( … Read more

Categories post-meta Tags actions, post-meta

WordPress Action Hooks and Post ID?

When hooking the save_post action, you really need to isolate your operations so that every page/post/post_type save doesn’t try to add your post meta to the post. function foo_save(){ if(isset($_REQUEST[‘bar’) update_post_meta($_REQUEST[‘post_ID’], ‘bar’, $_REQUEST[‘bar’]); } add_action(‘save_post’, ‘foo_save’); The main issue with your code above is posts_numericalvalue needs quotes. Also, to use $post->ID you will need to … Read more

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

Job of meta_key meta_value fields in database tables

Think of them as array key/value pairs (kinda). These tables are used to store additional data about particular posts, comments, or users. The meta_key is the name by which the meta_value is retrieved, plus you have associations with particular posts, comments, or users by means of IDs. As far as structure goes, that is about … Read more

Categories post-meta Tags meta-value, post-meta, user-meta

Problem With Order Item Meta In Woocommerce

Figured it out where I had if ( ! empty( $cart_item[‘presc_data’] ) ) woocommerce_add_order_item_meta( $item_id, ‘Olho Direito’, $cart_item[‘presc_right_sphere’] ); I had to change to $data = $cart_item[‘presc_data’]; if ( ! empty( $cart_item[‘presc_data’] ) ) woocommerce_add_order_item_meta( $item_id, ‘Olho Direito’, $data[‘presc_right_sphere’] );

Categories post-meta Tags post-meta, woocommerce-offtopic

How to sanitize post meta field value?

HTML in custom fields is, from my point of view, a weird use case of custom fields. Even more if the purpose of the used HTML is just look and feel (<strong> and <i> can be seen as just look and feel). It is really better if you use the HTML markup on the custom … Read more

Categories post-meta Tags post-meta, sanitization

Delete post meta conditionally after save post

Well, first use the hook properly. The post ID will be passed in. You don’t need $post->ID. Second, use the correct hook. If you want to run save_post only for your booking type, use save_post_booking But otherwise, the code works. I just ran a quick test. function booking_status_is_updated($post_id){ if(get_post_meta($post_id,’booking_status’,true)==’denied’){ delete_post_meta($post_id,’booking_slot’); } } add_action(‘save_post_booking’,’booking_status_is_updated’);

Categories post-meta Tags post-meta, save-post

How can I get values using key in Carbon Fields from Multiselect?

One of the Carbon Fields developers here. Thank you for your feedback! Currently, the Carbon Fields stores only the keys and they don’t have a built-in method to retrieve the selected values from the options array. You can pass a callable which returns an array with the options as an argument to the add_options method. … Read more

Categories post-meta Tags post-meta

Metabox Data not being saved [closed]

If that is all of your code, you’re missing a save_post action to save the data. Refer to the code sample provided on add_meta_box. add_action( ‘save_post’, ‘save_my_meta_box_data’ ); function save_my_meta_box_data( $post_id ){ // make sure it’s not an autosave if ( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return; // verify your nonce if ( !wp_verify_nonce( … Read more

Categories post-meta Tags metabox, post-meta

Correct processing of `$_POST`, following WordPress Coding Standards

Correct processing of `$_POST`, following WordPress Coding Standards

Categories post-meta Tags coding-standards, post-meta, sanitization, save-post
Older posts
Newer posts
← Previous Page1 … Page41 Page42 Page43 … 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
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 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