Support » Plugin: WordPress Popular Posts » Posts with Canonical Links not showing in popular posts feed

  • Resolved jennbryant

    (@jennbryant)


    This site features stories from other sites, but we create those stories as posts on our site then redirect them to the original site. We have canonical links on those posts. For some reason, Popular Posts only shows internal posts that do not point away from our site and does not consider any post that is directed to an external site. Is there any way to make it consider all posts?

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 23 total)
  • Plugin Author Héctor Cabrera

    (@hcabrera)

    Hi @jennbryant,

    If you’re doing a redirection to external URLs chances are WordPress Popular Posts doesn’t have enough time to track the interaction (view). If you share the code you guys are using to do the actual redirection I might be able to help.

    We are using the Page Links To plugin to redirect the posts that are originally from another site, and entering the canonical link in Yoast.

    Unfortunately, currently the plugin isn’t pulling anything at all, despite me having made no changes in the past couple of days. Now if you look at https://research.uga.edu/news/ and scroll to Most Popular, you see nothing under it. I’m assuming it’s a no data issue but data seems to be there, though it was working fine yesterday.

    Debug info:
    WordPress Popular Posts
    Debug
    PHP version: 7.3.10-1+ubuntu18.04.1+deb.sury.org+1

    PHP extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, sodium, session, standard, apache2handler, uopz, mysqlnd, newrelic, PDO, xml, bcmath, bz2, calendar, ctype, curl, dba, dom, mbstring, fileinfo, ftp, gd, gettext, gmp, gnupg, iconv, igbinary, imagick, imap, intl, json, ldap, exif, msgpack, mysqli, pdo_mysql, Phar, posix, readline, redis, shmop, SimpleXML, soap, sockets, ssh2, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlrpc, xmlwriter, xsl, zip, memcached, Zend OPcache

    Database version: 5.7.27-30-log

    InnoDB availability: DEFAULT

    WordPress version: 5.2.4

    Multisite: Yes

    External object cache: Yes

    WPP_CACHE_VIEWS: No

    Active plugins: ACF Content Analysis for Yoast SEO 2.3.0, Admin Menu Tree Page View 2.7.1, Advanced Custom Fields: Font Awesome 3.1.1, Advanced Custom Fields PRO 5.8.3, Advanced Menu Widget 0.4.1, Async JavaScript 2.19.07.14, Child Theme Generator 2.2.3, Classic Editor 1.5, Code Snippets 2.13.3, CSS AutoLoader 4, Custom Menu 1.8, Custom Post Type UI 1.7.0, Disable Comments 1.10.2, Duplicate Page 4.0, Enhanced Text Widget 1.4.6, Font Awesome 4.0.0-rc13, Font Awesome Shortcodes 4.2, Formidable Digital Signatures 2.03, Formidable Forms 4.03.01, Formidable Forms Pro 4.03.01, Formidable Locations 2.02, Formidable Registration 2.02.01, Icegram – Popups, Optins, CTAs & lot more… 1.10.33, Icegram Engage Pro 1.6, IconPress Lite 1.4.6, Insert Headers and Footers 1.4.4, Intuitive Custom Post Order 3.1.2, LayerSlider WP 6.9.1, Login Logo 0.9.0, Maintenance Mode 5.4, Max Mega Menu 2.7.2, Network Plugin Auditor 1.10.1, OVPR Buckets 0.0.1, OVPR Topics 0.0.1, Page Links To 3.1.2, Plugin Activation Status 1.0.2.1, Prime Mover Pro 1.0.5, Related Posts for WordPress Premium 1.9.0, Relevanssi Premium 2.4.3, Sassy Social Share 3.3.4, Shortcodes Ultimate 5.6.0, Simple Lightbox 2.7.1, Smush 3.3.1, SSL Insecure Content Fixer 2.7.2, SVG Icons for Visual Composer 1.2, TablePress 1.9.2, Ultimate Addons for WPBakery Page Builder 3.19.0, Ultimate Posts Widget 2.0.7, Unconfirmed 1.3.3, Video Thumbnails 2.12.3, Visualizer: Tables and Charts Manager for WordPress 3.3.2, Widget Shortcode 0.3.4, WordPress Importer 0.6.4, WordPress Popular Posts 5.0.1, WPBakery Page Builder 6.0.5, WP Gallery Custom Links 1.12, WP Instagram Widget 2.0.3, WP Theme Update 1.1.0, Yoast SEO 12.4

    Theme: UGA Research 2019 (1.0) by Allison Skinner

    Plugin Author Héctor Cabrera

    (@hcabrera)

    Hi @jennbryant,

    We are using the Page Links To plugin to redirect the posts that are originally from another site, and entering the canonical link in Yoast.

    Got it. I’ll have a look at that plugin and see if there’s anything we can use to have it update the views count of your stories before redirecting the user to the external site.

    Unfortunately, currently the plugin isn’t pulling anything at all, despite me having made no changes in the past couple of days. Now if you look at https://research.uga.edu/news/ and scroll to Most Popular, you see nothing under it. I’m assuming it’s a no data issue but data seems to be there, though it was working fine yesterday.

    This is a different issue and it would have been better if you posted this in a new topic but since we’re here already I guess I can look into this as well.

    If it was working yesterday and you haven’t done any changes to your site in the past 24 hours (updated plugins, updated WordPress, etc) then I’m not entirely sure what might be going on.

    I see you’re using WPBakery on your site. How did you add the popular posts section to your News page?

    I can start another topic if you wish.

    The Popular Posts plugin was added inside of a regular row with a Raw HTML Element with the shortcode inside it.

    • This reply was modified 2 months, 2 weeks ago by jennbryant.
    Plugin Author Héctor Cabrera

    (@hcabrera)

    Got it, thanks! I’ll give that a try and come back here in a bit.

    Plugin Author Héctor Cabrera

    (@hcabrera)

    Alright, it’s pretty late over here but I did promise I’d come back and so here I am.

    I had a look at the Page Links To plugin and as it turns out it does have an action hook called page_links_to_redirect_url that allows us to perform an action right before redirecting the visitor to the external URL. I tested it and it kinda works:

    /**
     * Updates the views count of a story prior redirecting the visitor
     * to the external URL.
     *
     * @param int $post_id
     * @param string $external_url
     */
    function wp6143_update_views_count_and_redirect($post_id, $external_url){
    	$update_views_count_request = new WP_REST_Request(
    		'POST',
    		'/wordpress-popular-posts/v1/popular-posts'
    	);
    	$update_views_count_request->set_query_params(array(
    		'wpp_id' => $post_id
    	));
    
    	rest_do_request($update_views_count_request);
    }
    add_action('page_links_to_redirect_url', 'wp6143_update_views_count_and_redirect', 10, 2);

    I say that it kinda works because this code will get triggered only if the visitor happens to access the URL of the story directly (eg. https://www.example.com/some-story-that-actually-redirects-to-another-website) otherwise the code won’t be run at all and no views count updating will be done. But I guess it’s at least something.

    As for WordPress Popular Posts and WPBakery, I realized that the most recent version of the latter that I have around is 5.4.2 while you have version 6.0.5 installed on your site.

    I’m pointing this out because when I tried adding the [wpp] shortcode to the Raw HTML Element as you instructed, well, the shortcode wasn’t rendered and all I saw on screen was the shortcode itself ([wpp]). I then tried a using different element, the Text Block, and then the [wpp] shortcode was rendered normally (popular posts were shown).

    It could be that something changed between versions 5.4.2 and 6.0.5 that’s messing around with the shortcode, or it could be something entirely else. Can’t say without being able to reproduce the issue myself.

    Oh, one more thing: could you please share the settings you’re using with the WPP plugin? (Go to Settings > WordPress Popular Posts > Tools and take screenshots of those options.)

    Thanks so much for sticking around to help. A++ customer service.

    I think I understand – you’re saying that even if your code is added to the plugin, if a user does not somehow click on the actual link to the story that’s offsite, the story still won’t be rated among the internal popular posts? If so, there’s no way for the user to do that, because they click on a link that takes them to the post we’ve recreated on our site but the post then sends them to the outbound link. Am I misunderstanding?

    I tried adding the [wpp] shortcode to a regular text block but it’s still not working for me. Whereas, on our staging site which was created several days ago (https://ugaresearchst.wpengine.com/news/), the [wpp] shortcode that’s in a raw html element still works. On that staging site, there are 15 plugins that need to be updated, but WP Bakery is not one of them. I’m going to make a backup of the Staging site and then update those plugins one by one, and see if one of them broke stuff. I’ll let you know if I find anything.

    OK! Well the plugin that broke the Most Popular section on the staging site when updated was… WordPress Popular Posts! It was at Version 4.2.2, and it updated to 5.0.1, and the posts disappeared. I don’t know what that means, but it was the last plugin I updated. I think I’ll try rolling back the staging site and trying again, but this time updating WordPress Popular Posts first and seeing if there’s a conflict with another plugin. Maybe it is the version of WP Bakery that’s the difference, I don’t know.

    At this time getting the Popular Posts section to display correctly is priority for us, then we will worry about getting the outbound links to work. I’m sorry this is two issues in one thread; let me know if you want me to break them apart!

    Plugin Author Héctor Cabrera

    (@hcabrera)

    Thanks so much for sticking around to help. A++ customer service.

    Don’t mention it 🙂

    I think I understand – you’re saying that even if your code is added to the plugin, if a user does not somehow click on the actual link to the story that’s offsite, the story still won’t be rated among the internal popular posts?

    I’m not familiar with how your site integrates with the Page Links To plugin but after seeing how the plugin works I’d say no, probably not.

    There’s another way to pull this off but it involves some programming including possibly making some minor modifications to your theme. If you have a developer who can help you with this I could provide further instructions.

    I tried adding the [wpp] shortcode to a regular text block but it’s still not working for me. (…) I’m going to make a backup of the Staging site and then update those plugins one by one, and see if one of them broke stuff. I’ll let you know if I find anything.

    Got it, please keep me posted.

    Plugin Author Héctor Cabrera

    (@hcabrera)

    Well, at least now we know it is something specific to WPP 5.0.

    Try checking the error log and see if there are any warning/error messages related to WPP in there.

    After rolling the staging site back to pre-updates, I updated the WPP plugin first and it still broke – so maybe it is an issue with the version of WP Bakery?

    Plugin Author Héctor Cabrera

    (@hcabrera)

    Could be, but again can’t say for sure without being able to replicate the issue (and since WP Bakery is a paid plugin I can’t upgrade without buying a new license, which might be a waste if it turns out that the problem isn’t WP Bakery hahaha).

    Try having a look at the error log as I mentioned earlier, hopefully there might be something in there that can lead us to the right direction.

    Error logs from the live site (not staging) are below.

    [Thu Nov 07 00:54:18.721531 2019] [php7:notice] [pid 18100] [client 104.196.170.65:55700] auditor:scan=fingerprint {"blog_id":1,"kind":"wp-core","name":"wp-includes","slug":"wp-includes","ver":"5.2.4","sig":"v1:a056884194a3da07fc752b3a52c09cc8ad93aa7c18c42b74c38453bb45cde245"}, referer: https://research.uga.edu/wp-cron.php?doing_wp_cron=1573088055.7672059535980224609375
    [Thu Nov 07 00:54:19.289441 2019] [php7:notice] [pid 18100] [client 104.196.170.65:55700] auditor:scan=fingerprint {"blog_id":1,"kind":"wp-core","name":"wp-admin","slug":"wp-admin","ver":"5.2.4","sig":"v1:7a4117a4c97f7142dbc4554cab819e6b21ce26f35ea995c78e3a933457cfc81f"}, referer: https://research.uga.edu/wp-cron.php?doing_wp_cron=1573088055.7672059535980224609375

    [remainder redacted]

    • This reply was modified 2 months, 2 weeks ago by Steve Stern.
    • This reply was modified 2 months, 2 weeks ago by Steve Stern.
    Moderator Steve Stern

    (@sterndata)

    Support Team Volunteer

    @jennbryant

    1. Please don’t offer to send or post logon credentials on these forums:

    https://wordpress.org/support/guidelines#the-bad-stuff

    2. I redacted the extremely giant paste. Please use a service like pastebin.com and then put a link to that here.

    @hcabrera I’ve deleted your offer to login to your user’s site. I’m am 100% sure you mean well but please never ask for credentials on these forums.

    https://wordpress.org/support/guidelines/#the-bad-stuff

    Now for the why: The internet is a wonderful place full of very nice people and a few very bad ones. I’m sure everyone here is very nice however, by giving some ones keys to your house you are trusting they wont steal anything. Likewise the person who takes the keys is now responsible for the house FOREVER.

    If something was to go wrong, then you the author may well legally become liable for damages, which they would not normally have been as their software is provided without warranty.

    Please be aware that repeatedly asking for credentials will result in us escalating this to the plugins team.

    It’s never necessary to do that. Here’s why.

    There are many ways to get information you need and accessing the user’s site is not one of them. That’s going too far.

    You get the idea.

    Volunteer support is not easy. But these forums need to a safe place for all users, experienced or new. Accessing their system that way is a short cut that will get you into real trouble in these forums.

    I would never have posted login credentials, even to the unnecessary STAGING site as offered, on this thread. I didn’t think it would be against the rules for him to post an email address where I could send his login info. I’m not sure where to go from here.

Viewing 15 replies - 1 through 15 (of 23 total)
  • You must be logged in to reply to this topic.