Random post permalink

I built a similar feature for my personal website, that consists of a new database table, WordPress admin page and some .htaccess rewrites. Unfortunately the setup is too involved with my particular installation to be useful as a plugin, but there are plenty of URL shortener plugins available already. A quick search yields this WP … Read more

Sql syntax error

The error in the SQL statement is at the very end, SELECT * FROM c_posts WHERE id = , There is no value being supplied to check against the id column. This is most likely because you didn’t check for a blank value in the ID field before forming and executing the query. Check the … Read more

Custom Order in WP Query

Chain the filters: if ( ‘include’ == $query->query_vars[‘orderby’] ) add_filter( ‘posts_orderby’, /* … */ ); And in your orderby filter use: remove_filter( current_filter(), __FUNCTION__ );