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

Meta Data for Custom Post Type not saving

As the comments on the question indicated, this was basically a pile of garbage (my words, not theirs). There are a number of typos and inverted boolean checks. It was kind of a nightmare. I managed to get the code working, and I don’t like unanswered questions, so I wanted to work through the bugs … Read more

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

Read post meta values, only if posts are public

Yes, do an INNER JOIN, something like this should work: $values = $wpdb->get_col($wpdb->prepare(” SELECT meta_value FROM $wpdb->postmeta INNER JOIN $wpdb->posts {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id WHERE meta_key= %s AND {$wpdb->posts}.post_status=”publish”” ,$metakey )); I changed $wpdb->get_results() to $wpdb->get_col() since it looks like you are just selecting a single column of data as an array. I also added $wpdb->prepare() … Read more

Categories post-meta Tags post-meta, select, wpdb

get_post_meta not extracting title,permalink and posttype

Post metas are used for storing custom data that you want to store and retrieve yourself. The default post data post type, title, permalink are not saved in post meta. You can retrieve post_type and title using get_post() function which returns a WP_Post object. For permalink you need to use get_permalink() function like this. $post … Read more

Categories post-meta Tags post-meta

How to use json_decode a post_meta value? [duplicate]

The values look like they have been serialized using maybe_serialize( $data ). If that’s the case, then you can reverse that with maybe_unserialize( $original ). As per this answer, unserialize( $str ) will also create a PHP value from a stored representation. Try: $mydata=”a:3:{i:0;s:6:”ozujak”;i:1;s:7:”travanj”;i:2;s:7:”svibanj”;}”; $mydata = unserialize($mydata); echo $mydata[0]; // ozujak

Categories array Tags array, json, post-meta

How to hook into container

to hook in the <head> you would use wp_head. You can read the documentation here. add_action( ‘wp_head’, ‘meta_example’ ); function meta_example() { echo ‘<meta name=”description” content=”Meta Description for this Page.” />’; } // End meta_example() This assumes that your theme has <?php wp_head(); ?> in the <head>.

Categories loop Tags loop, post-meta, wp-head

Wp Super Cache stops the update of a Post Meta

When using WP Super Cache, the plugin generates static HTML files for your templates, which means that any PHP code you’re running will only ever run when the cached page is generated or regenerated. So if you need to trigger PHP code on every page load from behind a cache, you’ll need to use AJAX. … Read more

Categories theme-development Tags plugin-wp-supercache, post-meta, theme-development

Hidde certain category from post meta

From quick look through related functions I don’t think there is one that retrieves terms for the post and allows explicit exclusion. However there is a convenient filter the_category_list right inside the function you use, with array of category objects, before they are turned into HTML output. This should be a very fitting place to … Read more

Categories categories Tags categories, post-meta

Generate images to be associated for tag and category?

Ignoring our off-topic request for a plugin, the good news is: yes, this is possible. On the other hand, it is quite some work, so I will give just an outline here. WordPress does have built-in image manipulation. The default one is Image Magick. WordPress’ image editor class, however, only offers a subset of what … Read more

Categories images Tags hooks, images, post-meta, post-thumbnails, tags

Which is faster wpdb & get_row or wp_query & ge_post_meta?

You should always use get_post_meta. Your attempt to micro-optimise using a raw SQL query will reduce not improve performance. When you fetch a post, WordPress bulk fetches its meta for performance reasons, so if you used get_post_meta it would already have the answer in memory. If your site has an object cache then it would … Read more

Categories wp-query Tags mysql, performance, post-meta, wp-query, wpdb

Display Custom Meta Box Field Only If Value is Present

<?php if ( get_post_meta($post->ID, ‘floorplans’, true) ) : ?> Your code <?php endif; ?> Should do it… I believe

Categories custom-field Tags custom-field, metabox, post-meta
Older posts
Newer posts
← Previous Page1 … Page119 Page120 Page121 … 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