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

Search custom post type by meta data

In this case, as you mix pretty permalinks with request parameters, I would use the $_GET variables in your query. $query_args_meta = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘nc_property’, ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘nc_bedrooms’, ‘value’ => sanitize_text_field( $_GET[‘bedrooms’] ), ‘compare’ => ‘LIKE’ ), array( ‘key’ => ‘nc_type’, ‘value’ => sanitize_text_field( … Read more

Categories query Tags post-meta, query, query-variable, search

Strategy to get post meta for use outside the loop

Do you mean meta like in custom fields or information from post in general? Basically as long as you have post id you can get anything you want, not tied to the Loop. For custom fields there is get_post_meta(). For general information (like title or content) there is number of functions (many template tags can … Read more

Categories theme-development Tags loop, post-meta, theme-development

What is the most secure way to store post meta data in WP?

Use bcrypt. http://codahale.com/how-to-safely-store-a-password/

Categories Database Tags database, post-meta, security

Trying to get custom post meta through Jetpack JSON API [closed]

From the documentation: According to the JetPack JSON API docs: By default, all metadata keys are allowed in the API, as long as they are not protected keys. Any metadata key that starts with _ is by default protected. Protected metadata keys can, however, be accessed and edited by users with the edit_post_meta (used for … Read more

Categories post-meta Tags api, json, plugin-jetpack, post-meta

Ordering posts having multiple post-meta date fields

1) Using only the posts_orderby filter: It looks like you want to order the movies by the minimum of the wpcf-showtime meta values. You can modify the ORDER BY part of the SQL generated by the WP_Query, by using the posts_orderby filter. Here’s an example: add_filter( ‘posts_orderby’, ‘wpse_posts_orderby’ ); $ongoing_movies = new WP_Query( $args ); … Read more

Categories custom-post-types Tags custom-post-types, date-time, meta-query, order, post-meta

Auto sort the wp-admin post list by a meta key

Something like this should work: function wpa84258_admin_posts_sort_last_name( $query ){ global $pagenow; if( is_admin() && ‘edit.php’ == $pagenow && !isset( $_GET[‘orderby’] ) && !isset( $_GET[‘post_type’] ) ){ $query->set( ‘meta_key’, ‘last_name’ ); $query->set( ‘orderby’, ‘meta_value’ ); $query->set( ‘order’, ‘ASC’ ); } } add_action( ‘pre_get_posts’, ‘wpa84258_admin_posts_sort_last_name’ );

Categories custom-field Tags custom-field, post-meta, sort, wp-admin

WP_Query displaying ALL posts

It is because you are giving wrong arguments. Provide right arguments to WP_Query(). Also have a look at the custom field parameters One more thing, you will have to use code like $args = array( ‘posts_per_page’ => 5, ‘meta_query’ => array( array( ‘key’ => ‘display’, ‘value’ => ‘about’, ‘compare’ => ‘=’, // (Read all comparison … Read more

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

How to sanitize select box values in post meta?

When accepting user data inputs, I think that data validation must be performed if possible, not only sanitization. For example, you could expect a number, a bool value, a text string (even when the input is a selectbox it can have a string value), etc. You can santize for that data types; then you can … Read more

Categories theme-development Tags post-meta, sanitization, security, theme-development

How to hide meta box values from custom fields list?

Just add an underscore before the metabox ID so the part of your code where you add a metabox looks something like this: $id = ‘_drama-description’; $title=”Description”; $callback = ‘drama_description_metabox_markup’; $screen = $post_type; $context=”normal”; $priority = ‘high’; $callback_args=”null”; add_meta_box($id, $title, $callback, $screen, $context, $priority, $callback_args); You also need to replace every occurance of drama-description to … Read more

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

Delete duplicated wp_postmeta record

It is quite complicates grouped request, so to avoid problems, consider to use Cleanup Duplicate Meta plugin. The reason why duplicate entries are occured is usage of add_post_meta(). Just use update_post_meta() (even to create meta, it works) – and you will have always one meta field with certain name per post.

Categories posts Tags post-meta, posts
Older posts
Newer posts
← Previous Page1 … Page193 Page194 Page195 … 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