[Resolved] unable to view posts by categorys or tags
I have been having some issues WordPress where I am unable to view a list of posts for a given category or tag.
I initially assumed i had messed things up somewhere, so I decided to install a fresh copy of wordpress, but the problem remains!
The test install is at:
What I have done:
1) Download latest copy of wordpress-3.6.zip
2) Unzip to web root
3) Browse to the URL above, and follow the setup procedure
4) Browse to the URL above, and see the initial tewntythirteen themed landing page, with a preview section for the Hello World! sample post.
5) Click the link for the “Uncategorized” category
6) “Nothing Found” results page
Does anyone have any idea why a completely clean install would fail to function correctly?
Ideally i would like to use the Post Name permalink type, but until i can at least get this fixed, i’m not going to change anything…
@esmi: I have tried a few things, but nothing seems to work.
Purely for testing i have just completely wiped the install and reinstalled.
I believe clicking the Uncategorized link should return a list of all posts with that category, in this case, just the example Hello World post, but as I say, I just see a Nothing Found result…
I am happy to add a new post, but is there any reason to believe this would cause some change?
Also, should i leave the new post as Uncategorized, or should i create a new category?
Your assumption is correct. The Hello World post should be displayed when you click the Uncategorized link. Given that this a fresh install with no new plugins or themes, the first things that spring to mind are either a damage core file or a damaged database.
When you re-installed, did you use a fresh database and a fresh download of WordPress?
It was a fresh database, but not a fresh download. I’ll give that a try now!
As a side note, I am running it on my own web server (i.e. not a professional hosting environment), so could there be something i haven’t configured on the server?
I am running Apache 2.2.15 on Centos, PHP 5.3.3 and Percona MySQL server.
MySQL is defaulting to InnoDB tables.
OK, I have re-downloaded, but the two zip files (previous and latest download) and identical (tested with Beyond Compare).
After a reinstall (with new, blank database) there is no change, categories still not working….
The Apache VirtualHost config is:
<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName test.theparkerwilmottproject.co.uk DocumentRoot /var/www/test <Directory /var/www/test/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ErrorLog /var/log/httpd/test/error.log LogLevel warn CustomLog /var/log/httpd/test/access.log combined </VirtualHost>
show create database test;
CREATE DATABASE 'test'/*!40100 DEFAULT CHARACTER SET latin1 */
Good Catch! The error log is showing the following error:
WordPress database error 'test.wp_posts.post_date' isn't in GROUP BY for query SELECT YEAR(post_date) ASyear
, MONTH(post_date) ASmonth`, count(ID) as posts FROM wp_posts WHERE post_type = ‘post’ AND post_status = ‘publish’ GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC
made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/twentythirteen/page.php’), get_footer, locate_template, load_template, require_once(‘/themes/twentythirteen/footer.php’), get_sidebar, locate_template, load_template, require_once(‘/themes/twentythirteen/sidebar-main.php’), dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, WP_Widget_Archives->widget, wp_get_archives`
So when i run the query in MySQL, it looks like it’s not accepting the post_date field in the GROUP BY clause when it’s within the YEAR or MONTH function.
I would guess since others aren’t seeing this error, it must be something misconfigured in my MySQL.
Are you just running a standard WordPress install? To be honest, I’ve not come across this before and I’m at a bit of a loss as to suggest where you could start looking to fix it. What’s the collation type on the database?
If i alter the query to GROUP BY post_date rather than YEAR(post_date), MONTH(post_date) it appears to work fine!
so the GROUP BY functioned parameters are definitely the problem…
OK, I’ve got it!
In my MySQL configuration i have:
sql_mode = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY
It seems that Percona’s MySQL server ships in a slightly tighter configuration than the standard MySQL. In this instance, removing the ONLY_FULL_GROUP_BY fixes the issue by being a little less strict on GROUP BY clause parameters..
Thanks for your help!
Oh – nice one! I’ll flag this up for the core devs in case they want to look into it further.
One further thing i had completely forgotten, but completely related:
When i first installed a copy of wordpress (some months ago under a different domain, but same server) I had some trouble with the install because I got errors creating the database tables due to default dates of
On the same line in the my.cnf file, there was a parameter of NO_ZERO_DATE.
Once i removed this parameter, the install worked fine, but i have had the legacy problem of no category or tag functionality (fixed by our discussion above).
Probably worth mentioning to the devs in relation to this issue!
If possible, during the setup procedure, but before database table creation, it would be good to add:
1) Run the following query:
2) parse the result for ‘NO_ZERO_DATE’ and ‘ONLY_FULL_GROUP_BY’
3) if either are present, instruct the user to alter the ‘sql_mode’ setting in their my.cnf MySQL configuration file
- The topic ‘[Resolved] unable to view posts by categorys or tags’ is closed to new replies.