1

Is it possible the execute the called add_filter in theme after all plugins they've been loaded?

I use one of the plugins from repository to can add the ability to define custom target links for gallery item but this one packs additional things which breaks my angular routing so I want to remove theme.

the rule should work I have been tested. dumping html shows the plugins override is not present at this state.

I have in my functions.php

function attachment_link_sanitize($html) {
  $html = preg_replace("/class=\"no-lightbox\" target=\"_self\"/", "", $html);
  return $html;
}

add_filter('wp_get_attachment_link', 'attachment_link_sanitize',PHP_INT_MAX+1);

Sorry for disturbing I've been checking the plugins JS and seems like everything comes from Jquery

2
  • are you sure you are putting this code in the correct functions.php? is it firing at all?
    – Shawn
    Nov 3, 2014 at 19:21
  • yes is in the right place. Is in my custom active themes functions.php
    – fefe
    Nov 3, 2014 at 19:27

1 Answer 1

1

Yes set priority to something like 999 or something really high. The default priority is 10, and you currently have yours at 1 and therefore will occur first.

The priority is explained in the codex: http://codex.wordpress.org/Function_Reference/add_filter notably:

$priority (integer) (optional) Used to specify the order in which the functions associated with a particular action are executed. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the filter.

Default: 10

1
  • already tried the highest value won't seems t work
    – fefe
    Nov 3, 2014 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.