Custom Metadata Manager
[resolved] Please make plugins_url filterable with usual filter (4 posts)

  1. Jeremy Clarke
    Posted 5 years ago #

    Hi again, can you tell I'm making good use of your plugin?

    I am trying to filter the plugin_url() response in your plugin to fix an issue in my server related to symbolic links and the CSS file. The problem is that because you run plugin_url() in the root (non-hooked) context of your plugin I am unable to filter the value using the normal 'plugin_url' filter (because my plugin hasn't had a chance to register my filter yet).

    It seems that you foresaw this issue and added the 'custom-metadata-manager-default-css' filter to get around it. Am I right about that? It seems like you even tried to make your filter match the regular plugins_url one.

    If so I think you should consider moving the define(CUSTOM_METADATA_MANAGER_URL) call instead. By running that in your admin_init hook instead of the core of the plugin you allow other plugins a chance to register plugin_url filters before the constant is determined, which is much easier than asking them to have a custom filter just for your plugin.

    I tried it out and everything seems to still work fine with the define in the admin_init hook.



  2. cvernon
    Plugin Author

    Posted 5 years ago #

    This seems reasonable to me. Will check with Mo to see if he sees any reason not to move the define() into admin_init.

  3. Jeremy Clarke
    Posted 5 years ago #

    FWIW after writing the report above I realized that Akismet makes the same mistake and causes the exact same problem for me (I need to figure out where is best to propose changes to Akismet).

    The only solution was to set up my filter in an mu-plugin instead of a normal plugin, that way it gets included before any other plugin files and thus the filter on plugin_url works.

    Still would be good for you (and Akismet) to make the change, as being able to filter that URL is vital for many setups.


  4. Joey Kudish
    Plugin Author

    Posted 4 years ago #

    Hey Jeremy,

    Sorry it took 4 months, but I've just made this change in our trunk. Will push this fix out in 0.5.2 along with a few other bug fixes.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Metadata Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic