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

Filter posts by comparing custom meta value against postdate

I think the below solution will work- add_action( ‘pre_get_posts’, ‘the_dramatist_filter_shop_order’ ); function the_dramatist_filter_shop_order( $query ) { if( is_admin() && $query->is_main_query() && in_array( $query->get(‘post_type’), array(‘shop_order’) ) ) { add_filter( ‘posts_join’, ‘the_dramatist_shop_order_query_join’ ); add_filter( ‘posts_where’, ‘the_dramatist_shop_order_filter_date’ ); } } function the_dramatist_shop_order_filter_date( $where ){ global $wpdb; $where .= ” AND pm.meta_key = ‘_delivery_date_ymd’ AND pm.meta_value != ” AND … Read more

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

update_post_meta not work [closed]

What about the save hook? woocommerce_process_product_meta add_action( ‘woocommerce_process_product_meta’, ‘woo_add_custom_general_fields_save’ );

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

Unable to get specific value from post meta

Based on your var_dump() I can only assume the checked values are in the selecteclevels array which you can get by looping through the array: foreach( $meta[‘selectedlevels’] as $level ) { echo $level; } Or using array indices: echo $meta[‘selectedlevels’][0]. Note, get_post_meta() may return nothing, and you should check if the selectedlevels index even exists … Read more

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

Mass removing CSS from 1,700 post [closed]

You can remove them by replacing the line( .alignleft { float: left; } ) with empty space in database ( but you should avoid using SQL query). Make sure you have back up before trying anything. There is a php script which i used for replacing my loclahost url to live site url while migrating … Read more

Categories post-meta Tags blogger, post-editor, post-meta

Submitting Custom Post Types with custom fields from Front-end form

I don’t understand why you registered a shortcode if you aren’t using it. Your custom-form.php‘s code can be: <?php /** * Template Name: My Custom Form */ get_header(); echo do_shortcode(‘[custom_posts]’); get_footer(); ?> Now, back to your question, how to save and/or get the custom field value. Well, your method of saving the custom field (meta) … Read more

Categories custom-post-types Tags custom-field, custom-post-types, front-end, post-meta

Prevent custom field from being updated after first publish

You are updating the audio_url regardless of one was found in the content or not. Make it conditional: if(preg_match_all ( “/(http|https):\/\/.*\/(.*)\.(mp3|m4a|ogg|wav|wma)/”, $post->post_content, $matches )) { update_post_meta( $post_id, ‘audio_url’, $matches[0][0] ); } In this case, you could also use preg_match, because you’re only looking for a single instance. Also make sure that your regex does work … Read more

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

How to save meta checkbox WordPress

You can use this to update your post meta function save_metaboxes($post_ID){ if( isset($_POST[‘is_viewpay’]) ){ $featured = 1; } else{ $featured = 0; } update_post_meta( $post_id, ‘_is_viewpay’, $featured); } To make the checkbox checked, you can use something like this: <?php $check = $featured ? ‘checked’:”; ?> <input <?php echo $check; ?> name=”is-viewcheck” type=”checkbox” value=”1″> Is … Read more

Categories posts Tags metabox, post-meta, posts

How to I retrieve the ID from the Posts page?

You can use get_queried_object_id() to retrieve the page ID. $custom_seo_desc = \get_post_meta( get_queried_object_id(), ‘custom_page_desc’ ); You can verify the page for posts ID by looking at the option page_for_posts. $posts_page_id = get_option( ‘page_for_posts’ );

Categories posts Tags custom-field, id, metabox, post-meta, posts

Change all author links in Blog roll

did you try: function wpse_author_link( $link, $author_id, $author_nicename ){ return ‘http://example.com/’; } add_filter( ‘author_link’, ‘wpse_author_link’, 20, 3 );

Categories posts Tags author, functions, loop, post-meta, posts

Updating my Post when expiry date is past

You seem to confuse WP_Meta_Query with WP_Query obviously they are not the same and you can not use the first by itself to loop over post.

Categories post-meta Tags post-meta, wp-update-post
Older posts
Newer posts
← Previous Page1 … Page112 Page113 Page114 … 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