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

Save/update post_meta with Gutenberg from the panel

I found out this bug https://github.com/WordPress/gutenberg/issues/4989 If an attribute get data from meta, and then post is saved/updated, it always return as undefined

Categories rest-api Tags block-editor, post-meta, rest-api

how to build (custom) stats for post views, per month

I think I’d build that upon and already existing plugin that does the counting for me. I have made quite good experience with Post Views Counter as it also lets you use it in WP_Query. But WP-PostViews looks promising as well. Choose one. Next I’d query posts by view count from a WordPress cron event … Read more

Categories post-meta Tags post-meta, statistics, transient

Change description on specific WooCommerce product status change

To avoid an infinite loop on transition_post_status hook when using wp_update_post(), try: add_action(‘transition_post_status’, ‘new_product_add’, 10, 3); function new_product_add($new_status, $old_status, $post) { if( $old_status != ‘publish’ && $new_status == ‘pending’ && !empty($post->ID) && $post->post_type === ‘product’ ) { $term = get_term_by(‘name’, ‘فروش پیج اینستاگرام’, ‘product_cat’); wp_set_object_terms($post->ID, $term->term_id, ‘product_cat’, true); // unhook this function so it doesn’t … Read more

Categories PHP Tags description, php, post-meta, terms, woocommerce-offtopic

Custom Meta Box not Saving in Posts with Gutenberg Editor

So, it simply turns out that the method I usually use to save post meta doesn’t work in this context, even though it does in when using the classic editor. I don’t know why this is, but I did find another article (https://www.codeinwp.com/blog/make-plugin-compatible-with-gutenberg-sidebar-api/) and there was a line in there that eventually led me to … Read more

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

using multiple meta_key and meta_value in query_posts

This is not currently possible with query arguments alone (realm of filtering raw SQL query and such). If your task is not time-critical then I suggest to wait for upcoming WP 3.1 release. It will feature much more flexible querying capabilities for custom fields. See Advanced Metadata Queries for post on upcoming improvements.

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

Filtering multiple meta_values

‘meta_query’ is what you’re looking for: http://scribu.net/wordpress/advanced-metadata-queries.html

Categories post-meta Tags post-meta

WordPress Orderby Numeric Value Not Working

The plugin ‘Post Types Order‘ was the culprit. As Scribu pointed out above the plugin is filtering the Raw SQL query which it shouldn’t be doing. As a result, the argument ‘suppress_filters‘ wasn’t stopping the query being modified and the ‘orderby‘ argument was being completely ignored. As to how this behavior can be stopped, I’m … Read more

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

How to use post_id with a Class?

You can use update_post_meta() to save an array of values. It will be automatically serialized and unserialized. update_post_meta($post_id, ‘math’, array($a, $b, $c));

Categories post-meta Tags post-meta

conditional function to change post-meta background image

Have you checked the classes on your <body> element? It depends on the theme but WordPress has a function body_class() that dynamically adds a bunch of useful classes in there. It may look like this: <body class=”archive category category-news category-2 two-column content-sidebar”> As you can see it is a powerful helper as you can easily … Read more

Categories post-meta Tags post-meta

Is there a need for nonce with Post Metabox?

Yes, the save action has a nonce already. But you don’t know it – so you cannot validate it. Besides that, you may want to fill a meta box from other places like a user profile or the dashboard, and then you need your own nonce anyway. An example from my current work: There is … Read more

Categories theme-development Tags metabox, post-meta, theme-development
Older posts
Newer posts
← Previous Page1 … Page155 Page156 Page157 … 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