WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] unable to view posts by categorys or tags (23 posts)

  1. barneyparker
    Member
    Posted 11 months ago #

    Hi,

    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:
    http://test.theparkerwilmottproject.co.uk

    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...

  2. esmi
    Forum Moderator
    Posted 11 months ago #

    Have you tried publishing another post yet?

  3. barneyparker
    Member
    Posted 11 months ago #

    @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?

  4. esmi
    Forum Moderator
    Posted 11 months ago #

    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?

  5. barneyparker
    Member
    Posted 11 months ago #

    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.

  6. barneyparker
    Member
    Posted 11 months ago #

    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....

  7. barneyparker
    Member
    Posted 11 months ago #

    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>
  8. barneyparker
    Member
    Posted 11 months ago #

    in MySQL:

    show create database test;

    returns

    CREATE DATABASE 'test'/*!40100 DEFAULT CHARACTER SET latin1 */

  9. esmi
    Forum Moderator
    Posted 11 months ago #

    Anything in your error logs?

  10. barneyparker
    Member
    Posted 11 months ago #

    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.

    Any ideas?

  11. esmi
    Forum Moderator
    Posted 11 months ago #

    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?

  12. barneyparker
    Member
    Posted 11 months ago #

    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...

  13. barneyparker
    Member
    Posted 11 months ago #

    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!

  14. esmi
    Forum Moderator
    Posted 11 months ago #

    Oh - nice one! I'll flag this up for the core devs in case they want to look into it further.

  15. barneyparker
    Member
    Posted 11 months ago #

    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
    0000-00-00 00:00:00

    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:
    SELECT @@GLOBAL.sql_mode;

    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

  16. esmi
    Forum Moderator
    Posted 11 months ago #

    Was this using Percona again?

  17. barneyparker
    Member
    Posted 11 months ago #

    it was.

  18. esmi
    Forum Moderator
    Posted 11 months ago #

    Thanks. I've asked a couple of other people to have a look at this to see if we need to take it any further.

  19. esmi
    Forum Moderator
    Posted 10 months ago #

    Looks like someone beat you to a Trac ticket less than 2 weeks ago. :-)
    http://core.trac.wordpress.org/ticket/24912

    I've added a comments to that ticket referencing this topic.

  20. barneyparker
    Member
    Posted 10 months ago #

    Ah, so close!

    At least it's been accepted as something that needs to be looked at!

    Thanks for forwarding it to the Dev's! Such a silly error, but it's amazing how long it's taken me to resolve (having said that, it didn;t take long at all with your input!!!) :)

  21. esmi
    Forum Moderator
    Posted 10 months ago #

    No probs. I've been told that these kinds of issues should reduce as WordPress transitions away from being purely MySQL and moves to PDO. But that's long, long, term.

  22. mprewitt3abn
    Member
    Posted 10 months ago #

    Just a thanks, because I also used the Percona MySQL wizard, and had the same issue with "ONLY_FULL_GROUP_BY". The tool is designed to "harden" MySQL, but apparently it goes too far for WordPress.

  23. barneyparker
    Member
    Posted 10 months ago #

    It looks like the WordPress dev's are trying to make WordPress more SQL standards compliant because it would make it easier to use other SQL servers, however it's a big job and it will certainly take time to make the change. I try to run things in the more compliant mode, however in the case of WordPress you have to make the exception until they get time to fix it and test it thoroughly... Glad I could help!

Reply

You must log in to post.

About this Topic