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

if condition from post_meta not working in save_post

if condition from post_meta not working in save_post

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

wordpress query making site very slow

I have made some changes: SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id INNER JOIN wp_icl_translations t ON wp_posts.ID = t.element_id WHERE 1=1 AND t.element_type = CONCAT(‘post_’, wp_posts.post_type) AND wp_postmeta.meta_key = ‘post_views_count’ AND wp_posts.post_type=”post” AND wp_posts.post_status=”publish” AND ( (t.language_code=”fr” AND wp_posts.post_type IN (‘post’,’page’,’attachment’,’grille’,’podcast’,’equipe’)) OR wp_posts.post_type NOT IN (‘post’,’page’,’attachment’,’grille’,’podcast’,’equipe’) ) GROUP BY wp_posts.ID … Read more

Categories post-meta Tags plugin-wpml, post-meta

get_post_meta() returns nothing in save_post, publish_post, wp_after_insert_post

get_post_meta() returns nothing in save_post, publish_post, wp_after_insert_post

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

How to show wordpress post in the site based on custom field value?

This worked for me as long as it’s run only on the appropriate query. The key is MySQL’s FIELD() function, which lets you specify an arbitrary ordering. add_action( ‘pre_get_posts’, ‘add_match_times_to_query’ ); function add_match_times_to_query( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘meta_query’, array( ‘match_time’ => array( ‘key’ => ‘match_time’, ‘compare’ => ‘EXISTS’, … Read more

Categories post-meta Tags post-meta

Save frontend submission form field as custom field

I you need to use update_post_meta($post_id,’your_meta_key’,’your_meta_value’); or you can save in new variable like $city_value = $_POST[‘city_field’]; then code will be update_post_meta($post_id,’city_field’,$city_value);

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

Chance post id into post name

Does this meta field store some other post’s ID, of which you want to retrieve the post name? If so, try this <?php global $post; $customlink = get_post_meta( $post->ID, ‘clink’, true ); echo get_post_field( ‘post_name’, $customlink ); ?>

Categories post-meta Tags post-meta

Using Form to alter PHP variable [closed]

Don’t put your variables in single quotes. This: if(isset($submit)){ $args = array( ‘numberposts’ => 10, ‘meta_key’ => ‘$filter’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘DESC’, ‘post_type’ => ‘things’, ‘post_status’ => ‘publish’ ); $mystuff = get_posts( $args ); $name = $filter ; } Should be this: if(isset($submit)){ $args = array( ‘numberposts’ => 10, ‘meta_key’ => $filter, ‘orderby’ … Read more

Categories post-meta Tags forms, post-meta, variables

Problem with get_post_meta

I was having some issues like yours. It was because it was on a page template with a query above it. All I had to do was reset the query.

Categories post-meta Tags post-meta

query with custom field

A quick google search would have directed you to this page: http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters

Categories post-meta Tags post-meta

I am stuck between post meta function to call unique id

You have to use update_post_meta insted of add_post_meta if(isset($_POST[‘posrav’])) { if($_POST[‘posrav’]!=””) { $posrav=get_post_meta($post->ID,’pcom’,true); $posrav=$_POST[‘posrav’]; update_post_meta($post->ID,’pcom’,$posrav); } }

Categories post-meta Tags post-meta
Older posts
Newer posts
← Previous Page1 Page2 Page3 Page4 … Page51 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