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 is the author’s name given a different color?

You wrote .comment-list but that’s not the class, it’s .commentlist. You may also need to target the anchor link inside that tag explicitly to override link colours

Categories post-meta Tags author, comment-meta, comments, post-meta, wp-comment-query

“Cannot use import statement outside a module” JS error while adding a custom meta block?

You should use @wordpress/scripts so you can profit from modern JavaScript language features and JSX and transpile it to browser-compatible code. It’s really not complicated to use. Just install it via npm install @wordpress/scripts –save and than you can transpile your source file like this wp-scripts build src/myguten.js.js –output–path=js. It’s not only modern language features … Read more

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

why after saving meta value it’s saving all the values the one that i clicked?

Ok so we have things, and we want to favourite/unfavourite them as done. First, we need 2 functions: saeed_is_favourited( int $post_id, string $thing_to_favourite ) ( where $thing_to_favourite is the thing we’re marking as saved/favourited/etc, and $default is the value to return if we don’t know yet saeed_set_favourited( int $post_id, string $thing_to_favourite, bool $favourited ) where … Read more

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

Help with Post Meta

This makes no sense, required $key argument (defines which custom field value you want to retrieve) is missing: $post_meta = get_post_meta( $post->ID ); How are you actually assigning this to post? In this snippet you only assign array to some arbitrary variable: $brand_meta = array(… Also please clarify your condition, I am not sure what … Read more

Categories post-meta Tags post-meta

Add box with custom per-page properties

In WordPress these boxes are called “meta box” and to add one to your new/edit page screen you can use add_meta_box() function (look at the example at the bottom for the examples), you can also use this class which is nicely documented and does most of the job for you. Or you can use a … Read more

Categories post-meta Tags metabox, post-meta

How to obtain a group of post meta and assign each meta to other variables?

foreach ($boxes as $data) { $project[$data] = get_post_meta($post->ID, $data, true); } $item_a = $project[‘height’]; $item_b = $project[‘width’];

Categories post-meta Tags post-meta

Query posts WITHOUT a custom meta field

You have to do a join or a subquery: $querystr = ” SELECT $wpdb->posts.ID FROM $wpdb->posts WHERE $wpdb->posts.post_type=”post” AND $wpdb->posts.post_date < NOW() AND $wpdb->posts.ID NOT IN ( SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key = ‘_social_’ ) ORDER BY $wpdb->posts.score DESC LIMIT 1; “;

Categories post-meta Tags post-meta, query

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

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

get meta value from page query

When you are in your while loop, the parent query is already finished. So fetch the post meta value with get_post_meta(): $template = get_post_meta( get_the_ID(), ‘_wp_page_template’, TRUE );

Categories post-meta Tags post-meta
Older posts
Newer posts
← Previous Page1 … Page26 Page27 Page28 … 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