PluginProbe
Commerce7 for WordPress / trunk
Commerce7 for WordPress vtrunk
1.8.1 1.8.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.3.4 1.3.5 1.4.0 1.4.1 All 37 releases
wp-commerce7 / includes / yoast / load.php

load.php in Commerce7 for WordPress trunk, at includes/yoast/load.php

47 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Yoast Support
4 *
5 * Created Date: Wednesday October 12th 2022
6 * Author: Michael Bourne
7 * -----
8 * Last Modified: Wednesday, February 11th 2026, 8:28:22 pm
9 * Modified By: Michael Bourne
10 * -----
11 * Copyright (c) 2022 URSA6
12 *
13 * @package wp-commerce7
14 * @author Michael Bourne
15 * @license GPL3
16 * @link https://ursa6.com
17 * @since 1.3.3
18 */
19
20 if ( ! defined( 'ABSPATH' ) ) {
21 exit;
22 }
23
24 add_filter(
25 'wpseo_canonical',
26 function( $canonical_url ) {
27
28 $options = get_option( 'c7wp_settings' );
29
30 // If the user has not set custom routes, use the defaults.
31 if ( ! isset( $options['c7wp_frontend_routes'] ) || ! is_array( $options['c7wp_frontend_routes'] ) ) {
32 $product_route = 'product';
33 $collection_route = 'collection';
34 } else {
35 $product_route = $options['c7wp_frontend_routes']['product'];
36 $collection_route = $options['c7wp_frontend_routes']['collection'];
37 }
38
39 // If the current page is a product or collection page, return false to disable canonical URL.
40 if ( is_page( array( $product_route, $collection_route ) ) ) {
41 return false;
42 }
43
44 return $canonical_url;
45 }
46 );
47