WordPress.org

Ready to get started?Download WordPress

Forums

OptionTree
[resolved] Categories seem to not work anymore in 1.1.3 (11 posts)

  1. EvGreen
    Member
    Posted 3 years ago #

    Got mail this morning from user concerned that his blog is now displaying slider categories, which shouldn't obv, because those were excluded in optiontree. Tested it on my server, and indeed 1.1.3 got something messed up with categories and they don't work at all..

    I find it quite serious :(

  2. EvGreen
    Member
    Posted 3 years ago #

    it seems like the categories(and probably pages, posts) no longer return string of id numbers like 20,17,3 etc. but array by default, and even with $is_array set to false, it still returns array

  3. Derek Herman
    Member
    Plugin Author

    Posted 3 years ago #

    It's returning an array because that was the original intended value. All checkbox types were intended to be an array and therefore should have been treated like an array. The second someone clicks save all changes with the latest version of OT the new value for any option type that uses a checkbox will be saved as an array of values. So regardless of if you tell the function not to return an array it's an array and will be treated like one.

    What is the code you're using to exclude the slider type, are you doing your own explode on the comma separated list? The get_option_tree() function did that for you so can you explain a bit more as to what exactly broke with the update.

  4. Derek Herman
    Member
    Plugin Author

    Posted 3 years ago #

    Also, the title of this post is misleading because categories work perfectly fine, it's your themes implementation of them that broke.

    I'm uploading a patched v1.1.4 now to try and solve your issue by forcing the $is_array variable to need to be set to true or the values are indeed an array, but if new data is saved categories will become an array and the patch will no longer work.

  5. Derek Herman
    Member
    Plugin Author

    Posted 3 years ago #

    Uploading the patch now and should fix all your problems.

  6. Derek Herman
    Member
    Plugin Author

    Posted 3 years ago #

    In v1.1.4 if $is_array is set to false it will return a comma separated list of values.

  7. EvGreen
    Member
    Posted 3 years ago #

    Hi Derek
    I am well aware thats an array, but in 1.1.1 and 1.1.2 a simple
    $categories = get_option_tree( 'categories', '', true, false, -1 );
    would return and echo i.e. "20,11,3,2" etc
    and in 1.1.3 it was returning "Array"

    thus simpliest implementation of your plugin that I could think of:
    query_posts('cat=' . $categories );
    stopped working.
    And since it wasn't in the patchnotes I called it a bug.

    Thanks for 1.1.4, its back to way it was now :)

  8. Derek Herman
    Member
    Plugin Author

    Posted 3 years ago #

    Sorry for the confusion. Glad to know it's all working correctly now.

  9. wiltwyck
    Member
    Posted 3 years ago #

    ok - i'm lost by this statement:

    but if new data is saved categories will become an array and the patch will no longer work.

    will this:
    $categories = get_option_tree( 'mycat', '', false, false, -1 );

    now and forever return:
    "20,11,3,2" ???

  10. Derek Herman
    Member
    Plugin Author

    Posted 3 years ago #

    @wiltwyck It will now, yes. The patch it permanent and will always return the comma separated list if you have array set to false. The statement was made before the patch was pushed to SVN and I updated it again after I said that. There isn't an edit or delete comment in the forum unfortunately.

  11. wiltwyck
    Member
    Posted 3 years ago #

    thanks for the quick response Derek - much appreciated!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic