Limit the number of characters/words in an excerpt for a related posts section

You can use the get_the_excerpt filter to modify what’s printed by the_excerpt(): add_filter( ‘get_the_excerpt’, ‘wpse_367505_excerpt’ ); function wpse_367505_excerpt( $excerpt ) { return substr( $excerpt, 0, 50 ) . ‘ [Read More]’; } You can change the [Read More] text to whatever you’d like. Add this code to your theme’s functions.php file, and it should automatically … Read more

exclude particular category in api

I just figured it out, just in case it might be helpful for anyone in future: There is an option available to exclude a particular category – categories_exclude So, the new rest API would be: https://www.example.com/?rest_route=/wp/v2/posts&per_page=100&categories_exclude=10

Don’t update modified post date when user add a product review or comment?

WooCommerce seems to update the ‘last modified’ value of a product on every change. If you want to take a look at the source code, go to woocommerce\includes\data-stores\class-wc-product-data-store-cpt.php and check the function update. This solution seems to work, however it could be improved to make sure it doesn’t mess up with anything else. Basically checks … Read more