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

Showing Meta Data for Custom Post Types?

On a single custom post type (for example), you can see the post meta. However on your homepage archive loop, you cannot because the theme uses a different template for this. Check out Template Hierarchy. The “home” page in _s is governed by the “index.php” template. In which we see: get_template_part( ‘content’, get_post_format() ); Since … Read more

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

Can’t sort order of wp_query with 2 meta keys

As you can read in Codex about orderby and the WP_Query, you can use multiple orderby values as well: ‘orderby’ => ‘name meta_value’ simply by using a space in between. The available orderby values are listed in the Codex page. About your question: By default it should already work with your query. If it doesn’t, … Read more

Categories custom-post-types Tags custom-post-types, meta-query, post-meta, pre-get-posts, wp-query

Post meta checkbox becomes unchecked occasionally

The trouble is that save_post fires in lots of places other than the “edit post” screen – when it does, your code will think the checkbox is unchecked and overwrite your saved state. Add an additional hidden input to your meta box: <?php // Don’t global post, use the $post parameter already passed to the … Read more

Categories save-post Tags post-meta, save-post

Access post meta just after publishing

Here is the description of transition_post_status from the codex: This function’s access is marked as private. That means it is not intended for use by plugin and theme developers, but only in other core functions. It is listed here for completeness. Use any of these functions instead. Why not use the publish_post action instead? There … Read more

Categories hooks Tags hooks, post-meta, publish

WP Meta Query for some meta (array) values

Fields in database tables can not contain other types of data than text strings and numbers, and variations of them like dates and times. The field meta_value of wp_postmeta is a text field. So, when you store an array as meta_value you are really storing a string containing the serialized data that represents the original … Read more

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

How to display custom post meta in the appearance->menus page

The menu items boxes are created by the class Walker_Nav_Menu_Edit in wp-admin/includes/nav-menu.php. Thus to alter those boxes you’ll have to make your custom Walker I guess. But if you mean adding the new value to the nav menu meta-boxes (the boxes to the left side of the page) this will do the job: The function … Read more

Categories menus Tags admin, menus, post-meta

Updating post meta for custom post types

I really like your clean class structure 🙂 But I have a suggestion that might fix things (based on my experience with nonces and meta boxes from a plug-in I built last weekend): Don’t try to create the nonce field manually. You currently have: $nonce = wp_create_nonce( plugin_basename( __FILE__ ) ); … <input type=”hidden” name=”argus_edit_visitor” … Read more

Categories plugins Tags custom-post-types, customization, plugin-development, plugins, post-meta

Ordering posts by anniversary using only day and month

No, it’s not possible by using pre_get_posts alone. But you don’t have to use separate fields for the date. WP_Query, although doesn’t provide a simple query arg that would sort the posts by month and day only, you can use the posts_orderby filter hook to modify the ORDER BY clause (i.e. ORDER BY <the part … Read more

Categories custom-field Tags custom-field, date, meta-query, order, post-meta

WordPress altering my custom query, How to fix it?

Your code should work in theory. Your failure is not caused by the code in your question but rather due to external factors. Something else is causing this failure DEBUGGING THIS ISSUE Turn on debug and check for obvious errors and warnings. This should be a good indication on the soundness of all your code … Read more

Categories wp-query Tags custom-field, menu-order, meta-query, post-meta, wp-query

get_post_meta / update_post_meta array

You’re calling get_post_meta() in two different ways: the first, leaving $single unset (it defaults to false) will get you the full array of meta entries for the given key; the second, setting $single to true, will get only the first item with that key. What you want, I believe, is an array of user IDs … Read more

Categories post-meta Tags post-meta
Older posts
Newer posts
← Previous Page1 … Page176 Page177 Page178 … Page203 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