plugin posting wrong URL in facebook
-
I’m sure this has to be with some custom programming I’m doing on the website, but the plugin should be able to get the correct URL.
I have a custom posttype “a” and a custom posttype “b”. One of the metadata of the custom posttype “b” is to select 1 postype “a” (like to choose a category or something). Anyway,once you publish the posttype “b” it modifyies it url to have in it, posttype “a” something like : http://www.mywebsite.com/a/b, To do this I’m using the filter “post_type_link” . All works perfect, and wordpress is aware of this URL update, all plugins and wordpress itself, when you ask for the permalink of post id 999, it gets the http://www.mywebsite.com/a/b as expected. But when using this plugin, the URL posted on facebook is wrong, like it isn’t aware of my url update.
anyway I can fix this?
my code below so you can check it.
global $wp_rewrite; $wp_rewrite->add_rewrite_tag( '%_data_salida%', '([^&]+)', '?meta=' ); function extra_post_link( $permalink, $post, $leavename ) { if ( stripos( $permalink, '%_data_salida%' ) == false ) { return $permalink; } if ( is_object( $post ) && $post->post_type == 'reportes' ) { $_selected_post_slug = ''; $_selected_post_id = get_post_meta( $post->ID, '_data_salida', true ); if ( $_selected_post_id ) $_selected_post_slug = get_page_uri( $_selected_post_id ); if ( ! $_selected_post_slug ) return str_replace( '%_data_salida%', '', $permalink ); return str_replace( '%_data_salida%', "$_selected_post_slug/", $permalink ); } return $permalink; } add_filter( 'post_type_link', 'extra_post_link', 10, 3 );
The topic ‘plugin posting wrong URL in facebook’ is closed to new replies.