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

Create a new custom field for all posts based on current custom field

This will fire on init so you just need to refresh a page one time for it to work. I left out the actual value of $new_value — you need to define that. <?php add_action( ‘init’, ‘wpse_75308_update_video_meta’ ); function wpse_75308_update_video_meta() { // Get all posts $posts = get_posts( array( ‘numberposts’ => -1 ); // Loop … Read more

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

How to get custom image field of specific post id

see documentation for get_field. change: $attachment_id = get_field(‘image’); to pass the post ID as second argument: $attachment_id = get_field(‘image’, 299); or: $attachment_id = get_field(‘image’, $my_id);

Categories custom-field Tags advanced-custom-fields, custom-field, id, images, post-meta

Function to return values from metabox

I assume you use the plugin ‘Meta Box’. It should actually work fine if you try it with this line (Example with the Amazon Affiliate), just substitute $bookID with your ID or get_the_ID(): echo get_post_meta( $bookID, ‘rw_amz’, true ); Oh, and i just saw that you opened two array when defining your fields, the correct … Read more

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

Change wordpress meta tag description using WP functions

I don’t understand your attempt to use PHP_Exec, especially by embedding it in the content section of the page. That is going to run much too late to alter anything in the <head> of the document. Here is the problem you are facing, starting from what looks to be your primary question: So what I … Read more

Categories post-meta Tags description, post-meta

Custom fields or something else

Custom Fields are perfect for this when you want not different excerpt lenght, but also different excerpt content. Following code will add additional TinyMCE editor to the Edit Post admin page so you can write formatted excerpt specially for your front page. Excerpt will be stored in _wpse83958_front_page_excerpt custom field. Preceding underscore makes it invisible … Read more

Categories post-meta Tags excerpt, post-meta

Footnotes in custom fields

I think that what you need to do is find where your custom meta data is displayed and do this: echo jqFootnotes(get_post_meta($post_id, $key, $single)); That will run the jqFootnotes filter on your post meta, and I think that will do what you need (assuming that $post_id, $key, and $single are set appropriately).. Side note: just … Read more

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

How we can get “get_post_meta” of specific user who added it

There are various ways to achieve this you can either generate metakey value for update_post_meta in such a way that it will contain user id. //Example : global $user_ID,$post_ID; // Store the values update_post_meta($post_ID, ‘meta_key’.$user_ID, ‘$meta_value’); // Get the values $meta_values = get_post_meta($post_ID, ‘meta_key’.$user_ID); or you can save it in user meta as following //Example … Read more

Categories post-meta Tags post-meta

Add a class to post_class if more than one post shares same meta_value_num

add_filter(‘post_class’, function($classes){ global $wp_query; static $meta = array(); // first call gathers meta values if(!$meta) foreach($wp_query->posts as $post) $meta[$post->ID] = get_post_meta($post->ID, ‘your_meta_key’, true); // $wp_query->post should be the global (current) $post object $this_meta = $meta[$wp_query->post->ID]; if($this_meta){ $counts = array_count_values($meta); if($counts[$this_meta] > 1) $classes[] = ‘your_class’; } return $classes; }); (untested)

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

Store SNS share value via function.php

Within a function or method, the return statement immediately stops the execution of the earlier. Hence the last line never gets interpreted. Switch the order of this: return $social_score; update_post_meta($post_id, ‘_social_score’, $social_score); to this: update_post_meta($post_id, ‘_social_score’, $social_score); return $social_score; Update: You are using three different variables for the post id, namely: $post_ID, $post_id and $post->ID. … Read more

Categories facebook Tags facebook, post-meta, social-sharing

Best way to achieve multiple links in a post title

The easy way of doing this is to not display the title on your page template, and have a h1 header as the first thing in your content.

Categories custom-field Tags custom-field, customization, post-meta, title
Older posts
Newer posts
← Previous Page1 … Page80 Page81 Page82 … 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