Last active
January 11, 2024 13:40
-
-
Save MaximilianoRicoTabo/8e3e2375c4c79e2b87b22f2a798478ae to your computer and use it in GitHub Desktop.
Remove element from the default dimensions array in pmpro-google-analytics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove element from the default dimensions array in pmpro-google-analytics | |
* | |
* title: Remove an element from the default dimensions array in pmpro-google-analytics | |
* layout: snippet | |
* collection: add-ons, pmpro-google-analytics | |
* category: dimensions | |
* link: TBD | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
/** | |
* Remove category from the default dimensions array. | |
* | |
* @param array $dimensions The default dimensions. | |
* @return bool $return true if the page is the custom page, false otherwise. | |
*/ | |
function my_pmproga4_default_custom_dimension( $dimensions ) { | |
// Remove the category dimension. Change the unset dimensiion as needed. | |
unset( $dimension['category'] ); | |
return $dimensions; | |
} | |
add_filter( 'pmproga4_default_custom_dimension', 'my_pmproga4_default_custom_dimension' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment