• jpcody

    (@jpcody)


    The databases are being created, but they’re not being populated. I’m using the following code:

    <?php get_mostpopular("range=daily&order_by=views"); ?>

    And I’m just getting a “No data” result. I’ve tried hitting the page while logged out and from my mobile device to get some data in there, but nothing is being stuck in the database.

    Any advice?

    https://www.ads-software.com/extend/plugins/wordpress-popular-posts/

Viewing 15 replies - 1 through 15 (of 15 total)
  • Hi jpcody,

    Is your wp-admin folder password protected? Also, is this a fresh install of WordPress Popular Posts?

    Thread Starter jpcody

    (@jpcody)

    It is a fresh-install, and I do not believe the folder is password-protected. I see no reason why it would be. This is my first WP project, so it’s not beyond me to screw something up ??

    I see. I asked about the password protection thing because if my plugin can’t access the wp-admin folder (it needs to communicate with a file there called admin-ajax.php) there’s no way it could access your database and store any info at all.

    Anyways, what’s your site URL? Is it live now? Have you checked phpmyadmin already to see if there’s any data on wp_popularpostsdata and wp_popularpostsdatacache?

    Thread Starter jpcody

    (@jpcody)

    I have checked, with no luck. It’s live at: https://www.qworky.com/blog/

    Thanks so much for your help!

    I checked your site, and noticed that your current theme might not have the wp_head() tag on the <head> section.

    Can you please check this for me? If it’s not there, please add wp_head() before the closing </head> tag of your theme.

    I believe that should do it!

    Thread Starter jpcody

    (@jpcody)

    Solved; thanks!

    archon810

    (@archon810)

    @ikki24,

    I’m actually facing the same issue here: https://www.androidpolice.com – I’ve been working on the site for the last few months and just launched yesterday but the popular post data never got populated.

    The table is empty in the database. Is there any troubleshooting I can do?

    Thank you.

    Artem
    https://www.AndroidPolice.com
    https://beerpla.net

    Hi archon,

    Have you checked that your theme has the wp_head() tag on the <head> section of header.php?

    archon810

    (@archon810)

    @ikki24
    Absolutely – it prints out most of the queued CSS/JS:
    <?php wp_head(); ?>
    followed by my stylesheet and Google Analytics (async).

    I’m willing to do some debugging – just tell me what to look for and I’ll step through the code with my debugger.

    Edit: I debugged and saw this main SQL statement:
    SELECT *, meta_value + 0 AS viewcount FROM wp_posts LEFT JOIN wp_postmeta ON post_id = ID WHERE meta_key = 'pvc_views' AND post_status IN ('publish') AND post_type='post' AND post_password ='' AND (post_date >= DATE_SUB(CURDATE(), INTERVAL 2 year) OR post_type='page') ORDER BY viewcount DESC LIMIT 0, 5;

    The problem is, wp_postmeta has no meta_key with the value pvc_views, or pvcANYTHING. This is why it’s failing. I reactivated the plugin but the value didn’t appear.

    Note that I never added any calls to popular_posts_views() anywhere as instructions don’t say to do so. Looking into this further.

    Wait, that’s not from my plugin! I think you got confused, Artem, as my plugin does not contain any function called popular_posts_views() nor a similar SQL statement.

    Are you sure you’re using WordPress Popular Posts and not another plugin?

    archon810

    (@archon810)

    Crap! I am using this https://www.ads-software.com/extend/plugins/popular-posts-plugin/ and his other plugins. Doh.

    Don’t worry, it happens even to the best of us!

    If you’re using WordPress as a CMS and don’t want to muddy up your head tag code, you can add this cdoe as an alternative to adding the wp_head(); call. It condenses WordPress Popular Posts database update ajax post function wp_head hook into a single line.

    <?php if (is_single() || is_page()): ?>
     <script type="text/javascript">$.post('<?php echo admin_url('admin-ajax.php'); ?>', {action: 'wpp_update', token: '<?php echo wp_create_nonce('wpp-token'); ?>', id: <?php global $wp_query; echo $wp_query->post->ID; ?>});</script>
    <?php endif; ?>

    I have the same situation as described in the top post. I have installed and activated plugin WordPress Popular Posts on this site: https://64.13.225.75/. I had wp_head() tag in the <head> section. But tables related to this plugin weren’t created during installation. I created tables manually, but plugin isn’t working, table are still empty. Can anybody helps?

    It seems to me that your MySQL user doesn’t have enough permissions to create/write on tables, that’d explain why the WordPress Popular Posts plugin couldn’t create the needed tables to cache your popular posts.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘[Plugin: WordPress Popular Posts] Database not populating’ is closed to new replies.