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

Sort Posts By Custom Field Date?

Use meta_value instead of meta_value_num <?php $course = new wp_query( array ( ‘posts_per_page’ => ’10’ , ‘post_type’ => ‘course’, ‘orderby’ => ‘meta_value’, ‘meta_key’ => ‘course_date’, ‘order’ => ‘DESC’ ) ); ?>

Categories post-meta Tags date, post-meta, post-type

Is there any way to tell when wp_postmeta has been updated?

You are right the wp_postmeta table: does not save any kind of time stamp. Unlike for example the wp_posts table with post_date, post_modified and such. So you have to implement a mechanism to keep track of the points in time when votes happened yourself.

Categories posts Tags post-meta, posts

Display different information of a custom post type

Add categories to your custom posts. Ex: add_action( ‘init’, ‘create_gallery_taxonomies’, 0 ); function create_gallery_taxonomies() { $labels = array( ‘name’ => _x( ‘B&A Categories’, ‘taxonomy general name’ ), ‘singular_name’ => _x( ‘B&A’, ‘taxonomy singular name’ ), ‘search_items’ => __( ‘Search B&A Categories’ ), ‘all_items’ => __( ‘All B&A Categories’ ), ‘parent_item’ => __( ‘Parent B&A Category’ … Read more

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

Date format – Meta Box plugin

Probably but this would be using a PHP function along the lines of, $metadate = rwmb_meta( ‘ns_event_date’ ); $date = new DateTime($metadate); echo $date->format(‘d-M-Y’);

Categories plugins Tags metabox, plugins, post-meta

Order by meta value pro first then meta value free in my search function

EDIT 2 – FINAL EDIT Just before I start with this edit, just a few things here The code in my answer are the basics and meant to demonstrate the concepts. I have now tested both sets of code, and all works as expected. You have to add all your desired mark-up, styling and template … Read more

Categories query Tags meta-query, meta-value, post-meta, query

Meta data (Tags and Categories) for Custom Posts not showing.

Your argument for is_singular() is wrong It should be an array is_singular(array(‘post’,’movie’)) You can read more about the argument passed from this link here

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

esc_attr on get_post_meta [closed]

The best practice in the WordPress world is to “escape late” i.e. at the point of output. While the two examples are effectively the same, the first one would be more effective if that code is ever refactored and the value of $portf_icon changes between where it’s first assigned & where it’s output.

Categories post-meta Tags post-meta, sanitization

Can A Post Meta Field Store multiple values that are not in an array?

Meta data keys do not have to be unique, you can have multiple rows of the same key, each containing singular values. If you use get_post_meta to fetch a key and don’t set the 3rd argument to true, the function gets all the individual values and returns them as an array, which is not the … Read more

Categories post-meta Tags array, post-meta, sanitization

Displaying a div from an assigned meta_value when on a page

If you just want to check if a meta value exists before outputting markup, then if( get_post_meta( $post->ID, ‘_cmb_linkCheckbox’, true ) ){ ?> <section id=”footerLinks”> <?php // your markup… ?> </section> <?php } or if the value is “on”: if( ‘on’ == get_post_meta( $post->ID, ‘_cmb_linkCheckbox’, true ) ){ // etc.. }

Categories custom-post-types Tags custom-post-types, metabox, post-meta, wp-query

How to calculate the average of a post meta value(Numeric) of a specific author

You can use count_user_posts() function to get the number of total posts for specific author. With looping through all posts by the specific author, you can get the number of likes on each post and store it/add it in one variable. Here is a function for that. <?php function avg_num_of_likes() { $author = get_user_by( ‘id’, … Read more

Categories posts Tags post-meta, posts
Older posts
Newer posts
← Previous Page1 … Page109 Page110 Page111 … 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