WordPress.org

Forums

Breadcrumb NavXT
[resolved] taxonomy issue (6 posts)

  1. GJK
    Member
    Posted 2 years ago #

    I downloaded your plugin, Breadcrumb NavXT, and it works great! Really does what it promises to do,
    Only problem that I have is that I get this warning:

    Warning: Missing argument 2 for eventorganiser_update_venue_meta_cache() in /home/deb*****/domains/encorebarchem.nl/public_html/wp-content/plugins/event-organiser/includes/event-organiser-cpt.php on line 607

    when clicking on a venue (generated in event-organiser). First I started looking for an answer in the wordpress support forums. I found this answer by the author of the event-organiser plugin:

    I've not be able to confirm this yet - but if I'm right - it's in fact a bug with the breadcrumb plug-in. I've noticed in breadcrumb_navxt_class.php they have

    //Run through a filter for good measure
    $term->name = apply_filters("get_$taxonomy", $term->name)

    That is an incorrect use of the filter (its often best to avoid manually calling core filters anyway): term names can be common across taxonomies, so the taxonomy of the term should also be passed as a second argument

    I'm not a developer and I don't know how to fix this. Could you help me out with this?

    Regards,

    Gert-Jan
    http://www.encorebarchem.nl/agenda

    http://wordpress.org/extend/plugins/breadcrumb-navxt/

  2. John Havlik
    Member
    Plugin Author

    Posted 2 years ago #

    Well, for the "That is an incorrect use of the filter (its often best to avoid manually calling core filters anyway):" not exactly true, when there isn't another option, which there isn't in this case (or at least when that section of code was written, I should check on that), it is perfectly fine. WordPress has since added a second parameter to the call for explicitly sending the taxonomy, even though the hooking function already knows what taxonomy it is (can't hook to get_$taxonomy directly, have to hook to a specific taxonomy, e.g. get_category, get_post_tag, etc).

    The quick fix is to find:
    $term->name = apply_filters("get_$taxonomy", $term->name);
    and replace with:
    $term->name = apply_filters("get_$taxonomy", $term->name, $taxonomy);

    Or you could simply just delete the line, things should still work (though most plugins modifying term names may not affect the breadcrumb output for term names).

    I'll add that second parameter in the next release.

  3. Stephen Harris
    Member
    Posted 2 years ago #

    Hi mtekk,

    Just wanted to point out that the the filter is intended to filter the term object, not the term name (used in core: https://github.com/WordPress/WordPress/blob/master/wp-includes/taxonomy.php#L901 ).

    As for manually calling core filters, the reason I advise against it is because the behaviour of the filter may change (for instance adding an extra argument) and then the plug-in's use of the filter is out of sync core.

    I'm not sure exactly why its necessary to use that filter then? The terms have already been passed through get_the_terms filter?

  4. John Havlik
    Member
    Plugin Author

    Posted 2 years ago #

    Wow, that code has changed quite a bit since I last actually looked at it (and to be honest the filter call was written originally with only categories in mind and then was converted into the equivalent term/taxonomy call). In the process it looks like it changed from a name to a title/name to an object (as you pointed out).

    Looking at it now, it's probably best to remove that line (still a week out before I'll be able to dive into code again), and I need to do an audit of the filters I do call to ensure they're still necessary to call (and I probably should stop trying to do nice things for the multilingual plugin writers).

  5. John Havlik
    Member
    Plugin Author

    Posted 2 years ago #

    This was fixed in 4.3.0

  6. GJK
    Member
    Posted 2 years ago #

    Thanks, works perfect now!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Breadcrumb NavXT
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic