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

Sanitizing `wp_editor();` Values for Database, Edit, and Display

wp_kses to the rescue! My Editor Contains everything a Post Might Pass the result through wp_kses_post on the way in and out, and all should be good. Remember, this will strip out anything added by the_content filter, so to preserve oembeds and shortcodes, use this: echo apply_filters( ‘the_content’, wp_kses_post( $content ) ); You might also … Read more

Categories posts Tags custom-field, database, post-meta, posts, sanitization

How can I free up the memory used by update_post_meta?

It turns out that it was due to Query Monitor, a plugin that records info about each query. Every time update_post_meta ran, Query Monitor would store some data about the query, which eventually added up to be more than the server could handle. Running my example code on a default theme like Twenty Nineteen with … Read more

Categories plugin-development Tags cache, memory, mysql, plugin-development, post-meta

Displaying posts with only upcoming dates according their custom field date value

For this to work reliably, the date format in the database should be yyyy-mm-dd. Comparison type should be DATE or NUMERIC. If you take the date of 25-04-2012 in present format and compare it numerically to the date 26-04-1986, you can see what the issue will be: 25042012 < 26041986 ALso- if you’re doing these … Read more

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

How to make custom post meta wp_editor translatable?

it looks as already answered here on stackexchange (really detailed way), as first you can try: add_filter(‘soto_property’,’qtrans_convertURL’); Anyway, have a look here on qtranslate slug plugin, usually it save tons of troubles. And small note – if I were you, I would better use mqTranslate (which is based on qTranslate, but it’s compatible with last … Read more

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

Order posts according to user defined order for meta values?

My proposed solution is already posted by @cybmeta (+1), but I add it anyway, since it deals with it in a general way 😉 In the same way the WP_Query parameters: ‘post__in’ => [1,2,3], ‘orderby’ => ‘post__in’ give use the custom defined order: ORDERBY FIELD( wp_posts.ID, 1, 2, 3 ) we can define our own … Read more

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

Move value of one custom field to another

Here’s the solution update wp_postmeta set meta_key = ‘theme2035_embed’ where meta_key = ‘video’

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

How to add meta tag to wordpress posts filter?

There is not a standerized way to add HTML meta tags in WordPress but you can use wp_head action as a generic way to add meta tags. I think description meta tag should not be in the theme, as you suggest in your answer, because description meta tag is a property of the document, nothing … Read more

Categories post-meta Tags description, post-meta

Get posts by meta value with date

Depends what you are getting back from the ‘date_event’ post-meta field. That’s probably the culprit here — if it’s an actual date with a month and day, it’s not going to match what you are getting from date(‘Y’), which is just going to be ‘2018’. You can check the value in ‘date_event’ on any of … Read more

Categories post-meta Tags date, get-posts, post-meta

How to filter into post meta data before saving

The add_post_metadata and update_post_metadata filters are meant to allow filtering whether a specific meta data should be saved (added/updated) or not, only. The default value (of $check) is a null, and if you return anything other than exactly null (i.e. !== null), the meta data will not be saved (into the database). However, the add_metadata() … Read more

Categories filters Tags filters, post-meta

loop through all meta keys with get_post_meta

As @Sally CJ noted in the comment to your question, you should just omit the meta key: $meta = get_post_meta( $post->ID, ”, true ); echo $meta[‘car_year’]; // 2005 In PHP 7.1 you can use array destructing: [ ‘image_meta’ => $image_meta, ‘car_year’ => $car_year, ‘car_mileage’ => $car_mileage, ‘car_price’ => $car_price, ‘car_model’ => $car_model, ] = get_post_meta( … Read more

Categories post-meta Tags post-meta
Older posts
Newer posts
← Previous Page1 … Page171 Page172 Page173 … 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