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

gettext localization is not working

It depends how and where you use this string. Possibly, you have to localize the date according to the site settings: <?php $date_format = get_option( ‘date_format’ ); $timestamp = strtotime( get_the_time() ); $localized_date = date_i18n( $date_format, $timestamp );

Categories post-meta Tags localization, post-meta

get_post_meta not working with variable as a post_id for dynamically get the postid

You can try to add global $post; on top of your code. But it depends on where the function is called.

Categories custom-post-types Tags custom-post-types, id, post-meta, wp-mail

How to Disable option of meta field if that option is selected for any other post in custom post type?

If I understood you correctly, you want to prevent users from selecting a radio option, which have been already selected on another post, when the user is adding a new post, right? I think you need to first check if the user is on the “add new” page in your metabox. You can do that … Read more

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

WP cron and update post meta

What your are doing is that you are looping over an array of post objects. The get_posts() function returns objects, not ID’s. So what you will have to do is either use $post_id->ID or setup_postdata( $post_id ) and then use get_the_ID(). Might wanna rename $post_id to $post_object to avoid confusion.

Categories wp-cron Tags post-meta, wp-cron

Custom field metabox not showing in back-end

It turns out the latest Advanced Custom Fields update (from version 5.6.0 on) removes the core custom fields metaboxes by default. The way to restore it was to add a filter in functions.php: add_filter(‘acf/settings/remove_wp_meta_box’, ‘__return_false’);

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

add action save post type and update post meta woocommerce

I solved: add_action(‘save_post_product’, ‘update_post_meta_subito’, 10, 3 ); function update_post_meta_subito($post_id){ $prova_termine=”inzaghi”; $term_taxonomy_ids = wp_set_object_terms( $post_id, $prova_termine, ‘pa_autore’, true ); $thedata = Array( ‘pa_autore’=>Array( ‘name’=>’pa_autore’, ‘value’=>$prova_termine, ‘is_visible’ => ‘1’, ‘is_variation’ => ‘1’, ‘is_taxonomy’ => ‘1’ ), ); update_post_meta( $post_id, ‘_product_attributes’,$thedata); }

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

Reverse Cross-Sells (WooCommerce)

You could do it with a meta query $current_post_id = ‘YOUR_POST_ID’; $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => -1, ‘meta_query’ => array( array( ‘key’ => ‘_crosssell_ids’, ‘value’ => $current_post_id, ‘compare’ => ‘LIKE’ ) ) ); $query = new WP_Query($args); if($query->have_posts()){ while($query->have_posts()): $query->the_post(); $product = wc_get_product(get_the_ID()); // Do what you want with the product. endwhile; … Read more

Categories PHP Tags get-the-id, php, post-meta, woocommerce-offtopic

Is there any way to get all custom posts and all custom terms with it’s meta in few queries?

Is there any way to get all custom posts and all custom terms with it’s meta in few queries?

Categories query Tags cache, meta-query, optimization, post-meta, query

How do I get all authors posts of a custom post type outside loop

How do I get all authors posts of a custom post type outside loop

Categories custom-post-types Tags author, custom-post-types, post-meta, wp-query

Get post content before rendering

Get post content before rendering

Categories post-meta Tags post-meta, the-content
Older posts
Newer posts
← Previous Page1 … Page51 Page52 Page53 … 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