Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
in Q2A Core by

It looks like there is a piece of code in qa-page-question-post.php that blocks attempts to remove the category from a post:

            if (!isset($in['categoryid']))

When setting the category id of the question to "No category", the script sets $in['categoryid'] to NULL, which I guess is the equivalent of it not being set, so the script resets it back to the original value.  That's what seems to be happening, anyway.

I guess it's not often that you want to set the category to "No category", but it seems a little odd to not allow it intentionally, and it's making trouble for testing the Categorizer plugin.

Q2A version: 1.5

1 Answer

+2 votes
selected by
Best answer

Good catch. I think the solution is to replace this line in qa-page-question-post.php:

if (!isset($in['categoryid']))

... with ...

if (!array_key_exists('categoryid', $in))

This will be rolled into Q2A 1.5.1.

nice, it's funny that isset doesn't return true, since it does seem to be set to NULL.  good to know about array_key_exists, anyway.
Yes, that's part of the spec of isset: http://php.net/manual/en/function.isset.php