You asked if this code is safe to use, so I'm reviewing it from a coding perspective, not from whether it "works" or is the "best" way to do it. You said it works, so I won't concern myself with the functionality.
1. But the code *is* using the deprecated split() function, so the code will not work on PHP 5.3.0 or newer.
Those references to split() should be replaced with explode(). See more detail here:
http://www.zen-cart.com/entry.php?2-...use-on-PHP-5-3
2. If there is no valid result returned from the query (again, only in the part of the code you had highlighted), you're triggering PHP Notices needlessly.
So, changing this line, by adding the part in bold, would be suggested:
Code:
if (!$hide_status->EOF && $hide_status->fields['visibility_status'] < 1) {
If you've got a lot of categories, then it would be smarter to rewrite your whole "read the hide-categories status from the db for each category one-by-one in real time" into "read all the hide-categories-table data into an array once and just do the lookup on that array" in order to minimize the amount of database queries you're triggering.
But that's getting into optimization, instead of merely "will it work".