Support » Plugin: JM Twitter Cards » Disable Twitter cards on one page

  • Resolved wellstudio



    I have one page that dynamically loads content from another database through some GET variables. This means that JM twitter cards is coming up with empty data for the page. I’d like to add my own twitter card info in the page head with a wp_head hook.
    I know how to do all of that, the only problem is that I cannot disable JM twitter cards for this page. I will have a look at the hooks in wordpress, but is there an easy way (say a tick box) that i can disable JM twitter cards for one page?



Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi, I’ve worked this out for myself –
    There is a function in the plugin called ‘add_twitter_card_info’, which is added into wp_head.
    You have to use a remove action hook to get rid of it.
    This is the code I used to remove –
    remove_action('wp_head', 'add_twitter_card_info', 99);
    You can drop this into a theme template file before you call get_header(); to remove twitter cards from that page.
    Also, you must give it a priority of 99 (third argument) as it has to match the priority of the original add_action hook.
    Just dropping this in here incase anyone else needs the info.

    Plugin Author tweetpressfr


    while it might work I would not recommand to proceed this way. You’d better target pages in the functions.php or in a functionality plugin :

    function disable_twitter_card_info() {
    	if(is_page(array(19,'contact',21))) remove_action('wp_head', 'add_twitter_card_info',99);

    That’s true.
    In this case it was for a custom page that pulled details from a database based on some GET variables, so it was fine just to build it into that page template.
    But always good to put things in functions.php!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disable Twitter cards on one page’ is closed to new replies.