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

Why am I getting a “Call to member function format() on a non-object” error?

“Call to member function format() on a non-object” means that $formatted_date is not an object. Why do you need 2 functions for this? Can’t you just check the post meta for your custom field in the save routine? Especially with such a late priority the custom field should already be saved. function acf_set_expiry($post_id) { if … Read more

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

Unable to Call More than One Meta Box Output

Your code will be like this if( have_posts() ): while( have_posts()): the_post(); $txt_fld = get_post_meta( get_the_ID(), ‘dbt_text’, true ); $txt_fld2 = get_post_meta( get_the_ID(), ‘dbt_text’, true ); endwhile; endif; echo $txt_fld; echo $txt_fld2 like this way.

Categories PHP Tags functions, metabox, php, post-meta

How to use conditional statement with custom field

I think what you are looking for is get_post_meta() $courtesty = get_post_meta( get_the_ID(), ‘courtesy’, true ); // check if the custom field has a value if( ! empty( $courtesty ) ) { echo ‘<div class=”courtesy”>’ . $courtesty . ‘</div>’; }

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

Show value of select dropdown in meta box

Your meta option is post_options_select. You are using wrong meta key options-select in function display_content. But main point is that, you cannot control the sidebar layout from the_content filter. If selected option is ‘No Sidebar’ then you need to hide sidebar in your template. the_content only contains the content of the post. How it should … Read more

Categories metabox Tags metabox, post-meta

When sending a newsletter -not with wordpress- the server has 100% cpu [closed]

I guess you have two problems, and one is simply unveiling the other. The first problem is that the newsletter software/service is probably using unique links to track clicks and campaigns. For example, if Google Analytics tracking is enabled in a MailChimp campaign, it’ll append a utm_campaign variable to every target URL, and a unique … Read more

Categories posts Tags post-meta, posts

Plugin can’t be activated [closed]

The root of the problem is that isset expects a variable to be passed to it. Also, I’m assuming that you expect the get_post_meta() to return a scalar value and not an array, so I added the third parameter set to true. // 3rd param: $single. Value of true means get scalar value, not an … Read more

Categories plugin-development Tags activation, errors, plugin-development, post-meta

Custom meta boxes ID prefix showing on first category but not others

From what I can tell, this stems from your use of get_post_field(), which is reserved for fields found in the posts table of the database (ie: built-in to WordPress, rather than custom fields). For custom fields you should use get_post_meta().

Categories categories Tags categories, metabox, oembed, post-meta

Update meta_key value for a page

Go to the Page editor. Click the “Screen Options” box in the top right corner. In the dropdown, turn on the “Custom Fields” option. Now scroll down below the post editor area. Edit the fields as needed.

Categories sort Tags post-meta, sort

Trying to write shortcode with get_post_meta but isn’t working

There are several minor problems with your code: Firstly, you are using shorthand PHP tags, like <?= /*some stuff*/ ?> they won’t work – see WordPress Coding Standards – No Shorthand PHP Tags. Secondly, you are not echo‘ing the variable $client_name. Last but not least, you are saving your post meta with the name _client_name, … Read more

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

Orderby two meta fields not working

SPECIAL THANKS TO THIS ARTICLE: http://dotnordic.se/sorting-wordpress-posts-by-several-numeric-custom-fields/ $args = array( ‘post_type’ => ‘property’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘rc_repl_status’, ‘field’ => ‘slug’, ‘terms’ => ‘sold’ ) ), ‘posts_per_page’ => 100, ‘meta_key’ => ‘_rc_repl_property_year_sold’, ‘meta_query’ => array( array( ‘key’ => ‘_rc_repl_property_year_sold’ // do this to order by two meta field VALUES ), array( ‘key’ => ‘_rc_repl_property_acres’, … Read more

Categories wp-query Tags customization, order, post-meta, wp-query
Older posts
Newer posts
← Previous Page1 … Page87 Page88 Page89 … 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