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

Counting number of identical meta keys

You have a structural problem with your data. Serialized data in the database is terrible if you need to search over pieces of that serialized data. There is no reliable, efficient, and certainly no easy, SQL query to search over serialized data. “serialization” is a PHP mechanism. It isn’t SQL. To the database that is … Read more

Categories post-meta Tags count, post-meta

get_post_custom: get image URL instead of image ID

If its your own custom post type you should know the field names? Iterate through the fields – or better just get the required field – an then use the attachment Id with wp_get_attachment_image_src. http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src Chech the codex for further examples and Google for “WordPress custom post type fields”.

Categories images Tags images, post-meta, urls

Allow iframe in custom meta box

I tried your code and it works: I changed the wp_verify_nonce function, because that wasn’t working for me. I added an action instead of what it had. Now, for this to work, you have to create a nonce field with a code like this, of course that you can change the names if you want. … Read more

Categories metabox Tags escaping, iframe, metabox, post-meta

wordpress sorting using array merge by price in ascending order but price with 0 must be show last

hope this will usefull to some one. <?php /* ADDED by for sorting ASCENDING order but call for price (ie price with 0) last */ function my_sort_custom( $orderby, $query ){ global $wpdb; $orderby = ” case when CAST(meta_value AS SIGNED) = ‘0’ then 1 else 0 end ,CAST(meta_value AS SIGNED) “; return $orderby; } add_filter(‘posts_orderby’,’my_sort_custom’,10,2); … Read more

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

WP-API : post_meta not updated… but have another entry

I’ve answered my question… when your not giving the id of the post meta … it’s creating another one … you give the id and it’s updating… –

Categories post-meta Tags post-meta, wp-api

How to add together (get the sum) a field from all author’s posts

First you have to declare the global $wpdb before using it. Also you need to include the table prefix when calling the table names. global $wpdb; $posts_table = $wpdb->prefix . “posts”; $posts_meta_table = $wpdb->prefix . “postmeta”; Next get an array of post ids by the author needed( make sure you have the id of desired … Read more

Categories PHP Tags count, php, post-meta

Make Custom Fields Public in JSON – API

Check out this post under the “Get Posts Meta Field Is Not Available By Default” heading: https://1fix.io/blog/2015/07/20/query-vars-wp-api/

Categories custom-field Tags custom-field, json, post-meta, rest-api

add_post_meta insert null value into Database

Try update_post_meta function without esc_attr <?php update_post_meta($post_id, ‘province’, $_POST[‘postProvince’], true); ?>

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

SQL query : Select a thumbnail for a media

$Featured_image = $wpdb->get_results(” SELECT p.* FROM net_5_postmeta AS pm INNER JOIN net_5_posts AS p ON pm.meta_value=p.ID WHERE pm.post_id = $da_id AND pm.meta_key = ‘_thumbnail_id’ ORDER BY p.post_date DESC LIMIT 15 “,’ARRAY_A’); A related solution, to query for posts WITHOUT providing a post ID (ordered by post date, and using the wp_ database prefix): SELECT p1.*, … Read more

Categories Database Tags database, gallery, mysql, post-meta, sql

why get_post_meta is returning 0?

Please try below code and check if ‘sound_s‘ key exists in the array or not $file_id = get_post_meta($post_id); echo “<pre>”; print_r( $file_id ); exit;

Categories custom-post-types Tags custom-post-types, loop, post-meta
Older posts
Newer posts
← Previous Page1 … Page12 Page13 Page14 … 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