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 5 months, 3 weeks ago by
net.
-
This reply was modified 5 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.
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).
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.
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.