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

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

Query Custom Meta Value with Increment

Not tested but you can try this: $args = array( ‘posts_per_page’ => 4, ‘post_type’ => ‘post’, ‘meta_key’ => ‘meta-select’, ‘order’ => ‘ASC’, ‘orderby’ => ‘meta_value_num’, ‘meta_query’ => array( array( ‘key’ => ‘meta-select’, ‘value’ => array( 2, 3, 4, 5 ), ‘compare’ => ‘IN’, ), ), ); Ordering is done by value of meta field meta-select … Read more

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

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

Allow user to create instances of custom field

you can make repeating fields with the WP alchemy class http://www.farinspace.com/wpalchemy-metabox/#have_fields_and_multi

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

Update all posts automatically when using post_meta

Probably your already solved this (hopefully not by hand). This part of your question is intriguing: I found that if I open a post through WordPress front-end and then click “update” the custom field data and the post content “sync” Do you mean back-end, right? If so, I think a bulk update would solve this … Read more

Categories posts Tags custom-field, php, post-meta, posts, shortcode

Get ID of a page containing secondary loop in content

As others figured already out: If you have third party plugins with custom queries, you’ll have a bad day! One solution might be caching your results. Template (e.g.: page.php) while (have_posts()): the_post(); global $my_cached_data; $post_id = get_the_ID(); /* * If you have single meta keys, this array_map function * makes them easy to access; otherwise … Read more

Categories loop Tags content, loop, post-meta

Gutenberg how to make attribute to save to meta

The meta value is read when the block loads and assigned to the block attribute. Changes to the block will update the attribute and when the post saves the value will save to the meta. So, as far as I understood, there is no need to actually save anything in the registerBlockType js function. The … Read more

Categories custom-post-types Tags block-editor, custom-post-types, post-meta

Custom Queries: Joining On Meta Values From Two Custom Post Types

So based on our discussion, the meta named opposition (for match posts) has its value set to the slug of the corresponding club post; e.g. club-1, club-two, etc., right? If so, then you first get the ID of the club post using a custom query (see in the code below) and then you can access … Read more

Categories custom-post-types Tags custom-post-types, join-tables, meta-query, post-meta, query
Older posts
Newer posts
← Previous Page1 … Page189 Page190 Page191 … Page203 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
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 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