• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 5066322038

pending completion
5066322038

push

github

GitHub
Merge pull request #20316 from Yoast/JRF/ghactions-run-more-selectively

2550 of 29012 relevant lines covered (8.79%)

0.32 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/integrations/third-party/woocommerce-post-edit.php
1
<?php
2

3
namespace Yoast\WP\SEO\Integrations\Third_Party;
4

5
use WP_Post;
6
use Yoast\WP\SEO\Conditionals\Admin\Post_Conditional;
7
use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional;
8
use Yoast\WP\SEO\Integrations\Integration_Interface;
9

10
/**
11
 * A WooCommerce integration that runs in the post editor.
12
 */
13
class WooCommerce_Post_Edit implements Integration_Interface {
14

15
        /**
16
         * Register the hooks for this integration to work.
17
         *
18
         * @return void
19
         */
20
        public function register_hooks() {
21
                \add_filter( 'wpseo_post_edit_values', [ $this, 'remove_meta_description_date' ], 10, 2 );
×
22
        }
23

24
        /**
25
         * Only run this integration when WooCommerce is active and the user is in the post editor.
26
         *
27
         * @return string[] The conditionals that should be met before this integration is loaded.
28
         */
29
        public static function get_conditionals() {
30
                return [ WooCommerce_Conditional::class, Post_Conditional::class ];
×
31
        }
32

33
        /**
34
         * Don't show the date in the Google preview for WooCommerce products,
35
         * since Google does not show dates for product pages in the search results.
36
         *
37
         * @param array   $values Key-value map of variables we enqueue in the JavaScript of the post editor.
38
         * @param WP_Post $post   The post currently opened in the editor.
39
         *
40
         * @return array The values, where the `metaDescriptionDate` is set to the empty string.
41
         */
42
        public function remove_meta_description_date( $values, $post ) {
43
                if ( $post->post_type === 'product' ) {
×
44
                        $values['metaDescriptionDate'] = '';
×
45
                }
46

47
                return $values;
×
48
        }
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc