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 time functions show invalid time zone when using ‘c’ time format?

The issue is that for correct output WP needs to process date through date_i18n() function. When you use date format, hardcoded in PHP code (not simply saved in PHP DATE_* constant) like ‘c’ – it’s not available to your code and so for WP to process. System-wide fix would be to re-process date with analogous … Read more

Categories post-meta Tags date-time, post-meta, timestamp, timezones

How to access the post meta of a post that has just been published?

Solved it! Used save_post to run push_notification() as well as to run the function save_post_meta() that saves my post meta. The problem occurred coz push_notification() gets fired before save_post_meta() due to which the meta wasn’t being saved and therefore it remained inaccessible. Just changed priorities of the functions to make it work like so : … Read more

Categories post-meta Tags post-meta, publish

Remove post meta keys

I found this from just a Google search (Source) You have to change met value keys as you want. However, it is highly recommend to take a DB backup before running this code. <?php function delete_useless_post_meta() { global $wpdb; $table = $wpdb->prefix.’postmeta’; $wpdb->delete ($table, array(‘meta_key’ => ‘_edit_last’)); $wpdb->delete ($table, array(‘meta_key’ => ‘_edit_lock’)); $wpdb->delete ($table, array(‘meta_key’ … Read more

Categories post-meta Tags post-meta

Remove WordPress.org Meta link

Depending on your theme, they may be hard coded into a sidebar or footer file. If this is the case, you will need to get your hands dirty and edit your theme files. But you can usually remove them by adding a widget, as these items often only show up when no widgets have been … Read more

Categories post-meta Tags post-meta

publish_post action hook doesn’t give post_meta_data

If the wp_send_json() function is sending the right data, but for some reason you want to use another function to actually send the JSON data, then you can use wp_json_encode(). This is basically the only thing that wp_send_json() does before sending off the data. add_action( ‘publish_post’, ‘wpse_228607_publish_post’, 10, 2 ); function wpse_228607_publish_post( $post_id, $post ){ … Read more

Categories post-meta Tags post-meta

get_post_meta returning empty string when data shows in the database

Edit Invalid Answer The answer below is invalid as get_the_id() and get_the_ID() both return the required ID of the post inside the Loop. Thanks to @Jess_Pinkman for pointing it out. Your code should be working fine, but the only issue is you are using an incorrect function to get the ID of the post inside … Read more

Categories post-meta Tags post-meta

Restrict post edit/delete based on user ID and custom field

Through a lot more research and some trial and error, I figured out the correct code to use that will restrict a post from being edited based on the user ID AND a custom meta field. $user = get_current_user_id(); $super_users = array(1); The first two pieces of code within the function are important for restricting … Read more

Categories post-meta Tags actions, content-restriction, post-meta

How to update/insert custom field(post meta) data with wordpress REST API?

I just ran a test with your code and in my opinion, this is not working because you have an error in the get_callback function. First time it will try to get the subtitle( or the timing_of_experience) but it will trigger an error because it doesn’t exists in the first place and this error will … Read more

Categories post-meta Tags post-meta, wp-api

Trying to get custom post meta through Jetpack JSON API [closed]

From the documentation: According to the JetPack JSON API docs: By default, all metadata keys are allowed in the API, as long as they are not protected keys. Any metadata key that starts with _ is by default protected. Protected metadata keys can, however, be accessed and edited by users with the edit_post_meta (used for … Read more

Categories post-meta Tags api, json, plugin-jetpack, post-meta

Meta compare with date (stored as string) not working

Introducing STR_TO_DATE MySQL has a STR_TO_DATE function that you could leverage for the scope. To use it you need to filter the WHERE clause of a WP_Query, probably using posts_where filter. That function allows to format a column value as a date by using a specific format. By default, WordPress uses the CAST MySQL function … Read more

Categories post-meta Tags meta-query, post-meta
Older posts
Newer posts
← Previous Page1 … Page47 Page48 Page49 … 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