WordPress: Get IDs of *ALL* post tags

WordPress contains a function for getting the tags associated with a post (get_the_tags) but none for retrieving the IDs of all site wide available tags.

The solution to this problem is quite easy if you remember that post tags are nothing else but pre-defined taxonomies and that you can use the function get_terms to retrieve the terms of a taxonomy:

$tag_ids = get_terms( 'post_tag', array('fields' => 'ids', 'get' => 'all') );

Funny enough there is a function for getting all category IDs (get_all_category_ids).

Yet another rant about bad WordPress plugin programming habits

The other day I came across a plugin that provided some useful functions to WordPress but is so badly coded that I can’t recommend it to anyone to use it. Though there are a lot of blog posts ranting about people “doing it wrong” this not be named plugin does so many things wrong in one place that I’m simply feeling the urge to write about a few of them.
Continue reading Yet another rant about bad WordPress plugin programming habits

The selectbox mystery of WordPress

The other day I wanted to use a selectbox with 5 elements in my plugin’s option page. No problem I thought:


What everybody including me expects is something like this:

But I actually got this:

The mystery lies in the style sheet for the admin area:

#wpcontent select {
	padding: 2px;
	height: 2em;
	font-size: 12px;
}

This forces every selectbox to display only one element. I have no idea why this is implemented. There is also a ticket in the WP tracking system discussing this behaviour since two years.

The solution to this problem is quite easy: