Restore woocommerce orders

It’s Simple. Step 1: Create a replica of the instance. Step 2: Import the old .sql file which contained one day lost orders data. Step 3: Use https://wordpress.org/plugins/woocommerce-simply-order-export/ plugin and export CSV or XML of 1 day data which you have lost. Step 4: Install the above plugin in the LIVE instance and import the … Read more

Is it advisable to use $post->comment_count instead of get_comments_number( $post_id )

This is that classic question, do you have 6 eggs or half a dozen, and frankly, it doesn’t actually matter. It is however better to use get_comments_number() because the post object is retrieved from the $GLOBALS[‘post’] global which is set by the_post() inside the loop the post object is validated through WP_Post (through get_post()) the … Read more

Edit custom fields in posts list

Yes, you can use Admin Columns Pro (paid plugin with free version) to use inline edit for custom fields columns just from the WordPress posts list. It even comes with sorting and filtering for columns. You can easily add new columns with this plugin. https://www.admincolumns.com/ There are also plugins that allows you to bulk edit … Read more

How to display the requested post only?

WordPress creates the default query on each page automatically based on the requested URL. Your template file should contain the standard loop to output whatever the default query contains. if( have_posts() ){ while( have_posts() ){ the_post(); the_title(); the_content(); } }

Display value of custom field at the beginning of a post

You need to prepend value stored in _subtitle to the content of the post so that it works. Please place following code in your theme’s functions.php file and it shall work. Please let me know how it goes so that I may assist further: add_filter( ‘the_content’, ‘prepend_subtitle_to_content’ ); function prepend_subtitle_to_content( $content ){ $subtitle = get_post_meta( … Read more

Sticky Post from page 2 and on

Sticky posts are a pain in the butt, and is not properly implememnted IMHO. The source code clearly shows that sticky posts are only moved to the top on page one of the homepage (or any custom instance of WP_Query which emulates the homepage), sticky posts does not get removed from the paged pages. This, … Read more