Forked from thomasgriffin/gist:c4e9e0d2f8254f6c4cf9
Last active
August 29, 2015 14:22
-
-
Save aaroneaton/3d511b27ec063c2888b2 to your computer and use it in GitHub Desktop.
This file contains 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 | |
add_filter( 'optin_monster_api_output', 'tgm_om_filter_lightbox_by_tag', 10, 4 ); | |
function tgm_om_filter_lightbox_by_tag( $optins, $optin, $fields, $post_id ) { | |
// If in a particular tag, remove the lightbox. | |
$cat_exc = 362; // Replace with the tag ID to target. | |
$slug = 'sjdfhsjakdkg'; // Replace with the unique slug for the lightbox you want to remove. | |
$tags = wp_get_object_terms( $post_id, 'post_tag', array( 'fields' => 'ids' ) ); | |
foreach ( (array) $tags as $tag_id ) { | |
if ( $tag_id && $tag_id == $cat_exc && in_array( $slug, $optins ) ) { | |
unset( $optins[ $slug ] ); | |
break; | |
} | |
} | |
// Return the modified output. | |
return $optins; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment