Thank you for your feedback.
Sounds reasonable, but my only concern about the proposed change is whether it could be the cause of any errors, if the user hasn’t enabled categories & tags for pages. This needs to be tested.
Nothing fancy in there, it just turns on native Tag/Cat support for Pages, which is off by default.
I’d appreciate it if you could be more specific about how I could test whether this feature has been enabled or not.
is_object_in_term() seems like a good way to check it. Your feedback is welcome.
Enabling the native support uses WP function register_taxonomy_for_object_type.
Source of this function is wp-includes/taxonomy.php.
It appears, while not well documented that I can find, that get_object_taxonomies is where you would want to go..
/**
* Return all of the taxonomy names that are of $object_type.
*
* It appears that this function can be used to find all of the names inside of
* $wp_taxonomies global variable.
*
* <code><?php $taxonomies = get_object_taxonomies('post'); ?></code> Should
* result in <code>Array('category', 'post_tag')</code>
*
* @package WordPress
* @subpackage Taxonomy
* @since 2.3.0
*
* @uses $wp_taxonomies
*
* @param array|string|object $object Name of the type of taxonomy object, or an object (row from posts)
* @param string $output The type of output to return, either taxonomy 'names' or 'objects'. 'names' is the default.
* @return array The names of all taxonomy of $object_type.
*/
function get_object_taxonomies($object, $output = 'names') {
...
Feel free to check out the plugin i’m using… there’s others like it, but it’s extremely simple… it registers the taxonomy, and then just a couple short functions to handle them..
Post Tags and Categories for Pages
Although, technically, I would guess that if tags and categories are disabled for pages, the function requesting a list of them would simply return empty anyway… Could be wrong on that, but it might not require any error checking..
Although, technically, I would guess that if tags and categories are disabled for pages, the function requesting a list of them would simply return empty anyway… Could be wrong on that, but it might not require any error checking.
You are right. Most probably it will work fine with the proposed modification only.
The upcoming release will contain the fix. However, I’ll need to thoroughly check whether a similar modification would be required in other parts of the code and also make sure that it will work fine for those who haven’t enabled categories and tags on pages.
Thanks again for your feedback.
Fixed in 2.4.2. Marking the topic as resolved.
If you like this plugin, rating it at WordPress.org would be much appreciated. Thanks in advance.