Skip to content

Instantly share code, notes, and snippets.

@octaedro
Created May 22, 2023 19:14
Show Gist options
  • Save octaedro/3b8c4921b0657bd5063bac5ad68b1ffa to your computer and use it in GitHub Desktop.
Save octaedro/3b8c4921b0657bd5063bac5ad68b1ffa to your computer and use it in GitHub Desktop.
Modify RIM rules
<?php
/**
* Plugin Name: Modify RIM rules
* Description: This plugin modifies the RIM rules.
* Version: 0.1
*
*/
function modify_rim_rules( $specs ) {
foreach ( $specs as $rim ) {
if ( isset( $rim->rules ) && strpos( $rim->slug, 'woopay-beta-merchantrecruitment-short-06MAY23-TEST' ) !== false ) {
foreach ( $rim->rules as $rule ) {
if ( isset( $rule->option_name ) && $rule->option_name === 'siteurl' ) {
$rule->operation = 'contains';
$transformer = new stdClass();
$transformer->use = 'prepare_url';
$rule->value = get_site_url();
$rule->transformers = array( $transformer );
}
}
}
}
return $specs;
}
add_filter( 'data_source_poller_specs', 'modify_rim_rules', 2, 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment