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

Using Advanced Custom Field (ACF) to insert meta description on each page

As mentioned in the comments, you are outside of the loop, so get_field will not know the ID. You can use the code below: <?php $meta_description = get_field(‘meta_description’, get_queried_object_id()); if(empty($meta_description)) { $meta_description = ‘This could be an interesting meta description’; } ?> <meta name=”description” content=”<?php echo $meta_description; ?> “/> If you use var_dump() in the … Read more

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

Need help on creating If-statement for custom meta fields

This gets asked a lot so lets try and fully explain it. We can simply wrap it in an if statement and echo the value, for example, <?php if ( get_post_meta($post->ID, ‘genre’, true) ) : ?> <?php echo get_post_meta($post->ID, ‘genre, true) ?> ?> <?php endif; ?> But that is ugly, and why do 2 queries … Read more

Categories conditional-content Tags conditional-content, post-meta

Custom post type category not displaying in custom post type

Simply use get_the_term_list ex: echo get_the_term_list( $post->ID, Taxonomy_NAME, ‘<span class=”the-category”>’, ‘, ‘, ‘</span>’ ); just change Taxonomy_NAME to your category taxonomy name, if its the default category taxonomy then change it to ‘category’

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

Getting post meta data, while editing a post in wp-admin panel [closed]

Getting post meta data, while editing a post in wp-admin panel [closed]

Categories wp-admin Tags post-meta, wp-admin

Change post format using custom field

If the plugin works the way I think it does, you could try changing the priority of your gateway_set_post_format function being added to the save_post action. Your plugin may have a larger priority number which would make it fire later than yours. If the plugin does not change the custom field value until after your … Read more

Categories posts Tags custom-field, post-formats, post-meta, posts, xml-rpc

Displaying Meta Box Image

I don’t know exactly how that plugin works, and you have posted code that is probably missing context but you need to define $post_meta_data before running line: $custom_image = $post_meta_data[‘image’][0]; It seems that the plugin is using post meta so you should need something like this: <?php echo get_post_meta($post->ID, $prefix.’hjemmeside’, true); ?> But rewritten to … Read more

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

Copying Custom Meta Values from existing post to a duplicate post

Copying Custom Meta Values from existing post to a duplicate post

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

How to use pagination with get_post_meta

How to use pagination with get_post_meta

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

Metabox of one post influence setting on other

The problem here is a slight error in the origianl code. Near the bottom of the save_sticky_metabox() callback, change the line – if(isset($_POST[‘was_checked’])) : To this – if($_POST[‘was_checked’] != 0) : The was_checked value is derived from a hidden field, not a checkbox, so regardless of the value it will always be set. Therefore we … Read more

Categories metabox Tags metabox, post-meta, save-post

Filter query posts by the count of metas for a meta key

Finally found out using two (single) posts metas : likes_log where I keep up to date an array where each entry is the time the item was liked. Entries are removed if they are too old (here, >1 month) likes_log_count where I update the number of entries in the previous log. function update_likes_monthly_count(){ if ( … Read more

Categories query Tags order, post-meta, pre-get-posts, query
Older posts
Newer posts
← Previous Page1 … Page173 Page174 Page175 … 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