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

get meta fields and taxonomy of any post type

If I understand correctly you want to get the taxonomies associated with a custom post type object, not with a specific single post. To do that you can use get_object_taxonomies(). For example, to get the names of the associated taxonomies to “my-custom-post-type”: $taxonomies = get_object_taxonomies( ‘my-custom-post-type’, ‘names’ ); foreach( $taxonomies as $taxname ) { echo … Read more

Categories custom-taxonomy Tags custom-taxonomy, post-meta

How to save dynamically generated value in post type?

How to save dynamically generated value in post type?

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

Adding custom fields to images

Where you put it depends, you likely want to put the get_post_meta() call: echo get_post_meta( get_the_ID(), ‘_custom_field’, true ) ); into the according template file. But of course you can also hook into a filter or action from your functions.php or a plugin.

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

Display a post count from a custom metabox selection

Try this code: function postsCount($meta_value) { $args = array( ‘numberposts’ => -1, ‘post_type’ => ‘custom_post_type’, // set you custom post type ‘meta_key’ => ‘project_select’, ‘meta_value’ => $meta_value, ); $my_posts = get_posts( $args ); $postsCount = count($my_posts); return $postsCount; } if ( is_user_logged_in() ) { echo postsCount(‘Draft’); echo postsCount(‘Completed’); } or if you want to get … Read more

Categories custom-post-types Tags custom-post-types, metabox, post-meta, posts, user-meta

How to create content automatically when a post is published?

You can use the transition_post_status action to manipulate the post content at the time when it is published. You just need to add a function like the one below into your theme or plugin: function post_published( $new_status, $old_status, $post ) { if ( $new_status == ‘publish’ && $old_status != $new_status) { //Do whatever you want … Read more

Categories custom-post-types Tags custom-post-types, get-posts, loop, post-meta, posts

Posts with no meta field do not appear when sorting by meta field

I believe if you specify ‘meta_key’ without a ‘meta_value’ it checks merely for the existence of the meta_key. I haven’t tried this but you might be able to specify a ‘meta_compare’ of ‘!=’ and some random value for ‘meta_value’ that you know would never actually be set as the value. $query->set( ‘meta_key’, ‘fieldA’ ); $query->set( … Read more

Categories post-meta Tags post-meta, sort

update_post_meta() not working in bulk option

update_post_meta() not working in bulk option

Categories post-meta Tags bulk, post-meta

retrieve wordpress post-meta using php not wordpress functions

The reverse mechanism should work. I assume you are trying the get post metadata with the post row. $resultat = mysqli_query($con,”SELECT * FROM wp_postmeta LEFT JOIN wp_post ON wp_postmeta.post_id = wp_post.ID WHERE wp_post.post_type=”shop_order””); However, there will be a lots of duplication. If one post have 100 metadata, you are also getting the post row 100 … Read more

Categories PHP Tags mysql, php, post-meta

Custom Search Query – include only custom fields and title

In my case I use a custom query so I can just use: $query = new WP_Query(array(‘post_type’ => ‘akteur’, ‘meta_query’ => array( ‘relation’ => ‘OR’, array(‘key’ => ‘wpcf-kurzbeschreibung’,’compare’ => ‘LIKE’,’value’ => $suchbegriff), array(‘key’ => ‘wpcf-zusatzinfo’,’compare’ => ‘LIKE’,’value’ => $suchbegriff) ) ));

Categories wp-query Tags custom-field, post-meta, search, wp-query

Include add_post_meta in a plugin

Please check the callback function name for example add_action( ‘woocommerce_process_product_meta’, ‘new_metabox_save’,35 ); Function definiton function new_metabox_save(){ $post = get_post( $post_id ); }

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