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

How to display post view count by date, week and month?

As you are doing update_post_meta( $post_id, $key, $count ); for which $key is ‘post_views_count’, you can’t. You are updating the meta key as is. You could however change how you are saving the meta key. You could add a prefix to the meta key you’re using to differentiate the day, week, and month. example for … Read more

Categories post-meta Tags post-meta, views

How can I convert postmeta from unserialized to serialized?

I would probably take an alternative route and let the serialization happen at the end after the data was already merged like in the example below. So first query meta data for both old keys. Then merge the old data into an array (regular or associative) with post ID as key. Then use the resulting … Read more

Categories post-meta Tags meta-value, post-meta

How to programmatically customise the Contact Form7 notification email prior to sending? [closed]

This can be achieved by hooking into the process of the notification mail being sent by the CF7 plugin. The plugin provides the ‘wpcf7_mail_components’ filter which allows you to modify the email message prior to it being sent, add_filter(‘wpcf7_mail_components’,’add_mgr_mail’,10,3); function add_mgr_mail($components, $form, $mail_obj){ //if you have several cf7 forms, check this is the right one, … Read more

Categories post-meta Tags plugin-contact-form-7, post-meta

Copy content stored in meta to post content

Here’s an example of how to get the meta and set it as the post content. You would need to add all the meta keys to the $meta_fields array. Obviously test this locally before running in production because it will overwrite whatever is currently in the post content. function migrate_post_data() { // Add all the … Read more

Categories post-meta Tags block-editor, post-content, post-meta, sanitization

Update post_meta with WooCommere variation data

Update post_meta with WooCommere variation data

Categories post-meta Tags post-meta

Unset field from an array not working as expected

Unset field from an array not working as expected

Categories post-meta Tags array, post-meta

Display All Custom Post Fields and Values, Unless Empty

This can easily be done with default PHP functions. // Loop through all fields, grab the content and assign it to a new array foreach ( get_post_custom() as $custom ) $new_custom[] = array_shift( $custom ); // Get rid of empty fields $new_custom = array_filter( $new_custom );

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

MySQL Query To Select Post By Postmeta

If I understand the question you are trying to show both post on single.php something like this should work as a second loop. Put This INSIDE the first loop. Do this so you can get the current post ID $parent_id=the_ID(); // Second Loop $query = new WP_Query( array ( ‘post_type’ => ‘TYPE1’, ‘meta_key’ => $parent_id … Read more

Categories post-meta Tags mysql, post-meta, wpdb

replacing the_autor or make callback

There is no need to change the the_author() function itself. A simple conditional tag will do the trick. Example: <?php /*** on your functions.php file ***/ function ifRegistered() { if(is_user_logged_in()) { the_author(); } else { echo get_the_post_meta($post->ID, ‘your_post_meta_key’, true); // or anything else, of course } } /*** on the template you want to use … Read more

Categories post-meta Tags loop, post-meta

Generate multiple goo.gl shortlinks for qtranslate bilingual blog

So I’ve managed to solve this. The googl_shortlink function from above now looks like this: function googl_shortlink($url, $post_id = false) { global $post; if (!$post_id && $post) $post_id = $post->ID; elseif ($post_id) $post = get_post($post_id); // list all the active languages in an array $enabled_languages = get_option(‘qtranslate_enabled_languages’); if (is_404()) return; if ($post && $post->post_status != … Read more

Categories post-meta Tags multi-language, plugin-qtranslate, post-meta
Older posts
Newer posts
← Previous Page1 … Page35 Page36 Page37 … 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