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

WP_POSTMETA – What do these values mean inside the data structure?

WordPress will serialize arrays when saving to post meta. The data stored under the key _employer_socials in your example looks like this: Array ( [0] => Array ( [network] => facebook [url] => # ) [1] => Array ( [network] => twitter [url] => # ) [2] => Array ( [network] => linkedin [url] => … Read more

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

update post meta for checkbox in the admin when inserted in the front-end

Welcome to WordPress SO. You may already have solved the issue as suggested by @Stevish, but just in order to avoid promoting the idea of checkboxes somehow being bad or difficult, I’d like to point out, that they’re perfectly okay and logical. 🙂 What is the problem in your first snippet, is the additional closing … Read more

Categories plugin-development Tags metabox, plugin-development, post-meta, wp-insert-post

ACF: How to get the full field name (meta_key) by a field key?

There’s a few ways to achieve this but here’s one which supports an unknown depth of children, for example where you have nested groups within groups. Given the field key “field_{some_hash}” of the field, this function will retrieve the field, and its parent most field, and so on until we reach the top of the … Read more

Categories custom-field Tags advanced-custom-fields, custom-field, post-meta, user-meta

Finding the page id

IDs always show in links in admin area, like /wp-admin/post.php?post=2164&action=edit There are also some plugins that simplify this, quick search came up with Simply Show IDs.

Categories post-meta Tags page-specific-settings, post-meta

Populate Custom Fields in a Custom Post Type?

you can do that with hooking a simple function to save_post hook add_action(‘save_post’,’my_rating_field’); function my_rating_field($post_id){ global $post; // verify if this is an auto save routine. // If it is our form has not been submitted, so we dont want to do anything if ( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return; // verify this … Read more

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

delete post meta from db, even if does not exist?

The reason why in the code, you show there, that delete_post_meta() is run first, is because add_post_meta() is run after it. If the delete wasn’t done first then you would end up with multiple entries stored in the meta table. To be honest it would be better to use update_post_meta() rather than both delete_post_meta() and … Read more

Categories Database Tags database, post-meta

how to get all post with the same post meta?

As simple as this: $the_posts_you_want = get_posts( array( ‘meta_key’ => ‘project_id’ ) ); foreach ( $the_posts_you_want as $post ) { // Do whatever you need in here… // Read further how to inspect the post object: http://wordpress.stackexchange.com/questions/13063/how-to-inspect-global-variables-in-wordpress // echo each meta key echo $post->whatever; // or save it into a new array for further processing … Read more

Categories post-meta Tags post-meta

Metadata Query when storing data as array possible?

Short answer: NO! I’ve asked a similar question before mysql order by serialized data? and the answer i got is: The only possible case when serialized data is acceptable is when you don’t need to search , filter or order by through that data. In all other cases – store your data as a separated … Read more

Categories theme-development Tags post-meta, theme-development, wp-query

orderby in custom WP Query does not work

I had trouble with a similar issue of sorting posts from a custom post type in a specified order on their archive page. I used http://wordpress.org/extend/plugins/sort-query-posts/. The plugin lets you sort posts by author, comment_count, date, id, menu_order, modified, parent, or title. It only requires you to add the following lines <?php query_posts(array(‘post_type’=>’post_type_name’, ‘posts_per_page’ => … Read more

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

IF.. post meta show… Conditional Tag Help…?

So, I would refactor this a bit: <?php $featured = ( has_post_thumbnail() ? get_post_thumbnail() : false ); $first_img = false; $custom = false; if ( ! $featured ) { // No featured image; look for attached images and get the first one $attachments = get_children( ‘post_type=attachment&orderby=menu_order&post_mime_type=image&post_parent=”.$post->ID ); $first_img = ( $attachments ? wp_get_attachment_image_src($attachments[0]->ID, “thumbnail-size’) : … Read more

Categories query-posts Tags conditional-tags, post-meta, query-posts
Older posts
Newer posts
← Previous Page1 … Page149 Page150 Page151 … 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