PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / trunk
WCPOS – Point of Sale (POS) plugin for WooCommerce vtrunk
1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 1.9.13 1.9.12 1.9.11 1.9.10 1.9.9 All 158 releases
woocommerce-pos / includes / Integrations / WPSEO.php

WPSEO.php in WCPOS – Point of Sale (POS) plugin for WooCommerce trunk, at includes/Integrations/WPSEO.php

42 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPSEO.
4 *
5 * @package WCPOS\WooCommercePOS
6 */
7
8 namespace WCPOS\WooCommercePOS\Integrations;
9
10 /**
11 * Yoast SEO Integration
12 */
13 class WPSEO {
14 /**
15 * Constructor.
16 */
17 public function __construct() {
18 add_filter( 'option_wpseo', array( $this, 'remove_wpseo_rest_api_links' ), 10, 1 );
19 }
20
21 /**
22 * Yoast SEO adds SEO to the WC REST API by default, this adds to the download weight and can cause problems.
23 * It is programmatically turned off here for POS requests.
24 * This gets loaded and cached before the rest_api init hook, so we can't use the filter.
25 *
26 * QUESTION: How long is the WPSEO_Options cache persisted?
27 *
28 * @param array $wpseo_options The WPSEO options array.
29 */
30 public function remove_wpseo_rest_api_links( $wpseo_options ) {
31 $wpseo_options['remove_rest_api_links'] = false; // needed for WC API discovery.
32
33 if ( woocommerce_pos_request() ) {
34 $wpseo_options['remove_rest_api_links'] = true;
35 $wpseo_options['enable_headless_rest_endpoints'] = false;
36 return $wpseo_options;
37 }
38
39 return $wpseo_options;
40 }
41 }
42