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

Add category to post meta

you can use get_the_category_list() it will show a list of the categories of the post, you can also use get_the_category() it will return an array, you can iterate it to format it, you can find examples here.

Categories PHP Tags php, post-meta

Insert multiple metas in one time

If you “Import” Products, i assume you use the wp_insert_post function? In that case, you can use the meta_input argument like this: $args[‘meta_input’] = array( ‘meta_key_1’ => ‘meta_value_1’, ‘meta_key_2’ => ‘meta_key_2′, … ); Other than that, if you know EXACTLY what you’re doing, you could look into inserting the data directly by using the wpdb … Read more

Categories post-meta Tags post-meta

Woocommerce: order posts by meta key

meta_query should be an array of arrays like: … ‘meta_query’ => [ [ ‘key’ => ‘…’, ‘value’ => ‘…’, ], ], …

Categories wp-query Tags get-posts, post-meta, woocommerce-offtopic, wp-query

Is it safe to add a new field to meta_value field?

guid doesn’t affect the image URL, it is just used as a unique identifier. It could be random gobbledygook and as long as it is unique it wouldn’t make a difference. It should be safe to use postmeta as long as you aren’t using any plugins that would potentially completely overwrite all postmeta associated with … Read more

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

Is there a way to disable post meta caching for development?

There’s no caching system in WordPress core that would cause the issues you’re having. The post meta cache (WP_Object_Cache) is not persistent. Its purpose is to ensure that meta data is only loaded once per page, not every time get_post_meta(), for example, is used, but it does not cache those queries across page loads. Therefore … Read more

Categories post-meta Tags cache, post-meta

How to add post meta in while loop?

You should use init action hook. From the codex: init is useful for intercepting $_GET or $_POST triggers. The following code is just a sample and is untested: function wpse283607_handle_submit() { // check if form is POSTed and nonce is valid if ( ‘POST’ === $_SERVER[‘REQUEST_METHOD’] && wp_verify_nonce( $_REQUEST[‘_wpnonce’], ‘my-action’ ) ) { if ( … Read more

Categories PHP Tags forms, html, loop, php, post-meta

Migrating meta value to new meta value

Back up your database first, then run this query in phpMyAdmin (or if you don’t have phpMyAdmin, run the query out of functions.php on an admin hook using $wpdb->query): UPDATE wp_postmeta SET meta_key = ‘_logo’ WHERE meta_key = ‘_thumbnail_id’ This will preserve all of the current IDs and just change the name of the meta … Read more

Categories post-meta Tags post-meta

Frontend Form Checkbox Update ACF Field

To be compatible with ACF you should first find out how ACF is saving checkboxes values to database. As I now this is serialized array. When we know that we must save our frontend checkboxes in the same way. The good news is you can pass only array to update_post_meta and WordPress will take care … Read more

Categories advanced-custom-fields Tags advanced-custom-fields, front-end, post-meta

Get the author meta adds now

get_the_author_meta applies a filter get_the_author_{$field}, i.e. in your case it will be get_the_author_description: function stripp($value) { return str_replace(array(‘<p>’,'</p>’), ”, $value); } add_filter(‘get_the_author_description’, ‘stripp’); In case the p tag has attributes, you may have to modify the above accordingly, or use preg_replace.

Categories post-meta Tags author, post-meta

Save meta data with post, Without using any plugin [closed]

You can add custom meta fields for doing so. Here, is sample code for adding a meta field for post type post. For more details please refer to link. <?php /************************************************************************/ function myPrice_meta_box() { add_meta_box(‘myPrice_field’, ‘Price’, ‘myPrice_meta_box_callback’, ‘post’, ‘normal’, ‘high’); } add_action(‘add_meta_boxes’, ‘myPrice_meta_box’); /** * Prints the box content. * * @param WP_Post $post The … Read more

Categories metabox Tags meta-query, metabox, post-meta, save-post
Older posts
Newer posts
← Previous Page1 … Page96 Page97 Page98 … 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