Support » Plugin: NextScripts: Social Networks Auto-Poster » Not found content posted to Facebook after upgrade to Yoast SEO 14

  • net

    (@krstarica)


    Using “Use WP Cron to Schedule autoposts”.

    After upgrading to the latest Yoast SEO (version 14), auto-posting to Facebook creates “Page not found” posts.

    Facebook Sharing Debugger shows: “URL returned a bad HTTP response code” (404) and shows Canonical URL (from og:url): https://www.website.com/?p=123456

    Such page really does not exist.

    When click “Scrape again” button in Facebook Sharing Debugger, the page is fetched again and looks fine. Canonical URL becomes normal permalink, such as https://www.website.com/some/article

    Posting to Twitter is fine.

    When revert back to Yoast SEO 13.5 posting to Facebook is fine.

Viewing 6 replies - 16 through 21 (of 21 total)
  • Thread Starter net

    (@krstarica)

    It seems that it is using regular function get_permalink($postID);

    Checked the source code for it:
    https://developer.wordpress.org/reference/functions/get_permalink/

    if ( '' != $permalink && ! in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future' ) ) ) {
        ...
     } else {
        $permalink = home_url( '?p=' . $post->ID );
    }

    It returns https://www.website.com/?p=123456 and then Facebook tries to fetch it and gets 404 instead of redirecting it to pretty URL. That means that post status is not published. So how come SNAP tries to submit URL which is not published and how it is related to Yoast 14?

    • This reply was modified 10 months, 3 weeks ago by net.
    • This reply was modified 10 months, 3 weeks ago by net.

    Well, I placed some prints inside that method that gets the URL (nxs_getURL), and actually it retrieved the correct URLs, it never obtained an URL using the post id.

    This was tested on our production site, when some posts were being automatically posted on facebook with the error, but the links are not the problem. So the problem is not nxs_getURL, that means that the problem is being caused where in other place of the plugin, or not by the plugin at all.

    Thread Starter net

    (@krstarica)

    Can you debug URL of the page that was submitted to Facebook by SNAP using https://developers.facebook.com/tools/debug/

    Check “og:url” field.

    Is also has History link to see if there were any changes.

    Just did. Picked a “faulty shared post” and ran it through that tool. The fetched URL and canonial URL match, but in the history of the canonical URL appears that at first, the canonical URL was the one with the post id and then changed to the pretty URL one. The og:url meta tag field contains the correct URL (the pretty URL).

    Thread Starter net

    (@krstarica)

    Exactly that’s the problem.

    When using old Yoast 13.5 there is no history link, nor URL with post_id.

    So maybe this is the scenario:

    For some reason https://www.website.com/?p=123456 gets submitted while page still being in draft. Then Facebook visits website and gets Not found, because the page is not published yet.

    Thread Starter net

    (@krstarica)

    @nextscripts Here are related records from the “wp_nxs_log” table.

    id   	date	uid	act	nt	type	flt	nttype	msg	extInfo
    1309084	2020-07-22 19:20:11	0	Posted	<span style="color:#FA5069">Twitter</span> - Twitter	S	snap	TW	OK - Message Posted 	
    1309083	2020-07-22 19:20:10	0	Posted	<span style="color:#FA5069">Facebook</span> - Facebook	S	snap	FB	OK - Message Posted 	
    1309082	2020-07-22 19:20:02	0	Start =- 		BG	snap		------=========#### NEW AUTO-POST REQUEST ####=========------	PostID:(1490008) Automated
    1309081	2020-07-22 19:20:02	0	*** ID: 1490008, Type: post		BG	snap		Status Changed: future_to_publish. Autopost requested.	0

    Interesting thing is that posts to Twitter are fine, but not to Facebook.

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘Not found content posted to Facebook after upgrade to Yoast SEO 14’ is closed to new replies.