I use Bitly Wordpress plugin and function wp_get_shortlink(). On simple posts it works fine, but on custom post types the links are not converted and when I share on twitter, my share link is something like domain/?p=43432.
How I can solve my problem?
That VIP plugin doesn't support post_type values beyond "post" by default, but this handy function should solve it for you:
/**
* Add Bitly to CPT's
*/
function my_add_bitly_cpts( $post_types ) {
$post_types[] = 'my_custom_post_type_name';
return $post_types;
}
add_filter( 'bitly_post_types' , 'my_add_bitly_cpts' );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With