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

SQL query to change the value of a Custom Field

If you’re looking for raw SQL query, then this should help: UPDATE <PREFIX>postmeta SET meta_value=”temp4″ WHERE meta_value=”temp1″ AND meta_key = ‘post_template’ If you want to run this query from WP, then you can use this: global $wpdb; $wpdb->update( “{$wpdb->prefix}postmeta”, array( ‘meta_value’ => ‘temp4’ ), array( ‘meta_key’ => ‘post_template’, ‘meta_value’ => ‘temp1’ ) );

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

Export media library with metadata and import into new blog

Export media library with metadata and import into new blog

Categories post-meta Tags media, media-library, post-meta

Add Array record to Meta Post

That original value is a serialised array. If you want to see the original array you can use the unserialize() function, or a site like https://www.unserialize.com. The problem is that this isn’t working for your Array, because the serialised value is invalid. The problem is here: s:11:”target” “Target” is 6 letters, so this needs to … Read more

Categories array Tags array, post-meta

Using a comma instead of a pipe to separate metadata

The default way WordPress separates different types of meta data, such as in the post meta data, is using a pipe |. For example, Author Name | Date | Cat1, cat2, cat3 This isn’t correct. WordPress doesn’t have a default way that it displays this information. It’s entirely up to the theme developer. if you’d … Read more

Categories post-meta Tags post-meta

Automatically select template based on query string for New Posts

You can definitely accomplish this via the new_to_auto-draft action. This works because wp_insert_post has just finished taking the template from the post array and updating the meta to reflect this. You will essentially overwrite this value in the database right after it’s set. Here’s an example: function my_project_change_default_template( $post ) { if ( ! strpos( … Read more

Categories posts Tags post-meta, posts

Display multiple meta_key/meta_values by single SQL query

Display multiple meta_key/meta_values by single SQL query

Categories post-meta Tags mysql, post-meta

Custom Fields Not Showing (ACF not installed)

Custom Fields Not Showing (ACF not installed)

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

Allow HTML in Custom Metabox area

I fixed your input type/sanitization and escaping issues. I think there’s still some cleanup that could be done with this code though. I see inputs without labels, invalid attributes, etc. add_action( ‘add_meta_boxes_post’, function ( $post ) { if ( $post->_wp_page_template === ‘page-templates/skyscraper-post.php’ ) { add_meta_box( ‘sky_post_excerpt’, ‘SkyScraper Post Excerpt and Links’, ‘sky_post_excerpts’, ‘post’, ‘advanced’, ‘high’ … Read more

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

How to get post by meta value

I did by removing backslash(/) from Date. $resultdob = $_POST[‘studentdob’]; $studentdob = str_replace(“https://wordpress.stackexchange.com/”, “”, $resultdob);

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

update_metadata() appends shortcode data for every page refresh

Since my post meta data was holding this data even upon refresh, all I had to do was delete this metakey once all the shortcodes on my post content were processed. For that, I made another shortcode and invoked that with do_shortcode() on single.php since that only processes once at the end. Now once I … Read more

Categories shortcode Tags post-meta, shortcode
Older posts
Newer posts
← Previous Page1 … Page54 Page55 Page56 … 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