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

Empty meta-box returns publishdate if no value is set?

I’m half asleep here so correct me if I am wrong here but it looks to me like you are saving the publish date of the post each time you save the post, $wr_event_end_date = isset($_POST[‘wr_event_end_date’]) ? $_POST[‘wr_event_end_date’] : ”; $event_end_date = new DateTime($wr_event_end_date); update_post_meta($post->ID, “event_end_date”, $event_end_date->getTimestamp()); This -> $event_end_date->getTimestamp() being the culprit. So regardless … Read more

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

get Insert id for meta field

No need to get Insert id for meta field.You get key value by using this function. $user_some_value = get_user_meta( $user_id, some_key );

Categories post-meta Tags meta-query, post-meta, user-meta

Combining two meta_values within one row with query

You can use the WP_User_Query class which works much like WP_Query. The docs: http://codex.wordpress.org/Class_Reference/WP_User_Query Below is a dump of the WP_User object that it will return, in this example using: $wp_user_search = new WP_User_Query( array( ‘fields’ => ‘all_with_meta’ ) ); $get_users = $wp_user_search->get_results(); This should set you in the right direction because it was not … Read more

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

best way to use custom taxonomy, post type and meta in a job system

When the question comes to what to use Post Type, Taxonomies, custom fields ? I find that the understanding what each one of them stands for helps make the selection easier so i use: Post types – for all major data records that need/not to be displayed or queried. Taxonomies – for grouping posts/custom records … Read more

Categories custom-post-types Tags custom-post-types, custom-taxonomy, multi-taxonomy-query, post-meta

Display Meta Data with HTML?

Yes, just check if you got something back from the post meta: $value = get_post_meta($post->ID, ‘_cmb__description’,true); if ( $value ) echo “<div class=”box”>$value</div>”;

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

Remove Meta-boxes (Yoast SEO plugin) [duplicate]

See WordPress SEO by Yoast: Hide Meta boxes in posts for non-admins add_action(‘add_meta_boxes’, ‘yoast_is_toast’, 99); function yoast_is_toast(){ //capability of ‘manage_plugins’ equals admin, therefore if NOT administrator //hide the meta box from all other roles on the following ‘post_type’ //such as post, page, custom_post_type, etc if (!current_user_can(‘activate_plugins’)) { remove_meta_box(‘wpseo_meta’, ‘post_type’, ‘normal’); } }

Categories plugin-development Tags plugin-development, plugin-wp-seo-yoast, post-meta, wp-admin

Add a meta field to the list of results for a custom post type

There are a couple filters for that. I wrote a tutorial about adding custom columns, which is where the code below is from. The example is adding a column to the ‘page’ post type that displays the page’s template. You can hook into load-edit.php and use get_current_screen to grab the correct screen ID’s/filters. From there … Read more

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

meta post search

You have a typo in your $advtxtQuery query– $where =” (( post_typs LIKE ‘projects’)… For the rest, both queries are searching on the same key so use IN instead of trying to create two separate arrays, as in the Codex example below: $args = array( ‘post_type’ => ‘my_custom_post_type’, ‘meta_key’ => ‘age’, ‘orderby’ => ‘meta_value_num’, ‘order’ … Read more

Categories search Tags post-meta, search

Repeated nav bar queries failing to be cached

The Codex page for the Object Cache class holds the answer to this: By default, the object cache is non-persistent. This means that data stored in the cache resides in memory only and only for the duration of the request. Cached data will not be stored persistently across page loads unless you install a persistent … Read more

Categories post-meta Tags cache, menus, performance, post-meta

WP_Query meta compare must include ALL array values

You can have multiple meta_query arguments with the same key and that will produce the results you’re seeking. Here’s an example: $meta_query = array_map( create_function( ‘$a’, ‘return array(“key” => “row_amenities”, “value” => $a);’ ), $amenities ); $the_query = new WP_Query(array( ‘post_type’ => ‘listing’, ‘posts_per_page’ => -1, ‘post_status’ => ‘publish’, ‘category_name’ => ‘private_rental’, ‘orderby’ => ‘rand’, … Read more

Categories wp-query Tags meta-query, post-meta, query, wp-query
Older posts
Newer posts
← Previous Page1 … Page79 Page80 Page81 … 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