Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * 1. This enables full debug-level logging of Site Reviews
- */
- add_filter('site-reviews/console/level', '__return_zero', 1);
- /**
- * 2. This flushes the WordPress cache
- * @see https://developer.wordpress.org/reference/functions/wp_cache_flush/
- */
- add_action('init', function () {
- wp_cache_flush();
- });
- /**
- * 3. Here we log the database query that Site Reviews uses to get the review ids
- */
- add_filter('site-reviews/database/sql/query-review-ids', function ($statement) {
- glsr_log()->once('info', 'sql/query-review-ids', $statement);
- return $statement;
- });
- /**
- * 4. Finally, here we query the first 10 reviews and then log the details to the console.
- */
- add_action('wp_footer', function () {
- $reviews = glsr_get_reviews(['status' => 'all']); // This function is documented on the Site Reviews Help page
- // loop through the reviews that were found
- foreach ($reviews as $review) {
- $review->meta(); // load the review meta
- $review->custom(); // load any custom review fields
- glsr_log($review); // finally, log the review details to the console
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement