• Resolved michael033

    (@michael033)


    Widgets with the recent v4 branch seem to no longer exclude taxonomy IDs when prefixed with a minus sign. I’ve deleted and re-created the widgets to no avail. I’m experiencing the issue with seven WordPress v4.8.2 installations.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi there!

    I tested the taxonomy filter not long before releasing v4 and was able to exclude posts by tag ID and by category as well without issues. More details would be appreciated (screen captures of your settings would help in order to try and recreate the issue, for example.)

    Plugin Author Hector Cabrera

    (@hcabrera)

    Since I was curious, I just checked again:

    1. The list on my site before using the category filter to exclude entries that belong to “Web Design”: https://prnt.sc/gqkrz4
    2. My widget settings now: https://prnt.sc/gqksig
    3. The widget after excluding category “Web Design”: https://prntscr.com/gqksrw

    As you can see, it does work. You must be doing something differently. So, again, please share some more details so can try to replicate it over here.

    Thread Starter michael033

    (@michael033)

    Thanks for the quick reply. I’ve included a screenshot of one of the widget settings.

    View post on imgur.com

    Some notes:

    – The Category and Tag options are displayed twice because, I assume, I have a custom post type of ‘news’ with associated Category and Tag taxonomies; I’ve tried all four options with no changes.

    – ID 257 is based on the following the edit link: https://www.domain.com/wp-admin/term.php?taxonomy=category&tag_ID=257&post_type=news.

    – The ‘Show Widget For…’ options are from the Display Widgets plugin. Disabling the plugin doesn’t fix the issue.

    I’ve made no changes since the v4 upgrade, and downgrading to v3.3.4 fixes the problem once I re-enter ‘-257’ into the ‘Category(ies) ID(s):’ field (this setting seems to get cleared out when downgrading from v4).

    Plugin Author Hector Cabrera

    (@hcabrera)

    If I had to guess: since your taxonomy seems to be using the same name (and maybe even the same slug?) as WordPress’ stock taxonomy Category, things, well, break ??

    On versions 3.x the slug “category” is hard-coded into the query, so you never noticed this. With version 4.0 that’s no longer the case, the taxonomy slug is dynamically changed according to user settings so we can filter out posts by any given taxonomy (and not just categories as before.) So, if I’m right, WPP is asking the database to filter out posts related to a taxonomy with slug ‘category’, and in your case I suspect there are two of them which results in what you see now.

    Again, this is just a wild guess. I have too little info and it might actually be something entirely different. I need to replicate the issue so I can understand what’s going on.

    Let’s try this: could you please share the code you’re using to register your custom post type -including its taxonomies- so I can try it out here? If the code is lengthy, please consider using pastebin.com or some other medium.

    Thread Starter michael033

    (@michael033)

    I haven’t looked at this code in many years so it’s entirely possible this is my fault: https://gist.github.com/anonymous/55926d5a2b0ef11ad9cc9cb5634ba4bd.

    The intended goal with that code is to attach the already-registered ‘category’ taxonomy to the ‘news’ custom post type. It’s hooking into WordPress via ‘init’.

    ** I updated the gist link shortly after my initial response. The original gist included a ‘register_taxonomy_for_object_type’ which I added after the ‘register_post_type’ call to see if it fixed the issue. The current gist is the original code. **

    • This reply was modified 7 years, 5 months ago by michael033. Reason: I updated the gist link shortly after my initial response. The previous link was of code I just altered
    • This reply was modified 7 years, 5 months ago by michael033.
    Plugin Author Hector Cabrera

    (@hcabrera)

    Hey there!

    Took me a while but here I am. I was able to confirm that the taxonomy filter doesn’t work with custom post types (it does with “stock” ones though, which is why I never noticed so thanks for reporting).

    I’ll do some tests and may be needing your help with testing. If so, I’ll let you know.

    Sorry for the delay and thanks again for the heads up!

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hey there!

    This has been fixed in version 4.0.5. Please upgrade as soon as possible.

    Thread Starter michael033

    (@michael033)

    Thanks for looking into this issue and fixing it, Hector! Everything seems to be correctly working with v4.0.5.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Minus Sign Prefix Not Excluding Posts’ is closed to new replies.