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

Custom Media Meta fields to alter the generated image HTML that is inserted into a post for my animated GIF image player?

I got it solved…. function filter_image_send_to_editor($html, $id, $caption, $title, $align, $url, $size, $alt) { $animatedGif = (bool) get_post_meta($id, ‘animated_gif’, true); if($animatedGif){ $gifCoverImgUrl = get_post_meta( $id, ‘animated_gif_cover_url’, true ); // build my GIF player if(isset($gifCoverImgUrl) && $gifCoverImgUrl != ”){ $doc = new DOMDocument(); $doc->loadHTML($html); $xpath = new DOMXPath($doc); $src = $xpath->evaluate(“string(//img/@src)”); $html=”<img class=”gifplayer” src=””.$gifCoverImgUrl.'” data-gif=”‘.$src.'” />’; … Read more

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

WP Meta Query at depth 2

WP Meta Query at depth 2

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

Same Title on two different post type with single custom taxonomy

This is possible using a third party plugin. Most SEO Plugins let you manually set the Title and Description of the page independent from the Title and Slug of the post. The Slug itself is unique over the place to avoid duplication. One Plugin I know which is doing this good and works well in … Read more

Categories plugins Tags php, plugins, post-meta, seo

get_post_meta for Custom Post Type ( CPT )

Okay, so long story short… there’s no built-in wordpress way to Query the meta-data directly, but in the interests of helping others, essentially you need to do it the old-fashioned way… using SQL: I’m going to do up a post which I’ll link to… but essentially it involves straight SQL and $wpdb->get_results and some PHP … Read more

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

Get posts with Taxonomy term meta

This seems a little inconvenient since there are two hops from posts to terms to term meta. WP_Query cannot operate with term meta since it doesn’t directly apply to posts. Without knowing more context of your situation and term counts involved I would guess: Pre-calculate and cache the list of valid terms (those that fall … Read more

Categories taxonomy Tags post-meta, taxonomy

WordPress AJAX load post metadata in modal

you can use ajax url creating methode of wordpress. add_action(“wp_ajax_clientLogoPopup”, “clientLogoPopup”); add_action(“wp_ajax_nopriv_clientLogoPopup”, “clientLogoPopup”); function clientLogoPopup() { $clientID = intval($_REQUEST[‘client_id’]); if($clientID > 0){ echo get_post_meta($clientID , ‘client_logo’, true); // or you can also show other meta fields here. } die(); } write above script in functions.php of your theme now call the url as per your … Read more

Categories PHP Tags ajax, jquery, metabox, php, post-meta

How to get post meta for custom post type and taxonomy

Find The problem 😉 The answer is $hot_args = array( ‘post_type’ => ‘video’, ‘posts_per_page’ => ‘6’, “order” => “DESC”, ‘meta_key’ => ‘post_views_count’, ‘orderby’ => ‘meta_value_num’, ‘date_query’ => array( array( ‘after’ => ‘1 week ago’ ) ), “post__not_in” => $posts__not_in, ); $hot_query = new WP_Query( $hot_args ); There was not video as my custom post type … Read more

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

Ordering Posts By Meta Data

First: don’t use query_posts. It will confuse the main WordPress loop. You will need two queries. First use the query you have already constructed to get the priority posts: $query1 = new WP_Query( $args ); // here use the $args you already have Now count how many posts are returned to set the maximum return … Read more

Categories query-posts Tags meta-query, post-meta, query-posts

alt of attached image in post / pages

Use below code to get attached image title and alt. //Get attachment title & alt… $attachment_title=””; $attachment_alt=””; $args = array( ‘post_type’ => ‘attachment’, ‘numberposts’ => 1, ‘post_status’ => null, ‘post_parent’ => $post->ID, ‘post_mime_type’ => ‘image’); $attachments = get_posts($args); //If attachments exist… if($attachments) { //Loop until attachments… foreach( $attachments as $attachment ) { $attachment_title = $attachment->post_title; … Read more

Categories posts Tags post-meta, posts

Restore deleted _thumbnail_id in postmeta table

I figured it out. Somehow in the import process a trailing space was added to the meta_key (making it “_thumbnail_id “). Mysql apparently matches on a trailing space which is why it wasn’t apparent, but once I removed the space all featured images started showing again.

Categories post-meta Tags post-meta
Older posts
Newer posts
← Previous Page1 … Page39 Page40 Page41 … 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