Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bitly links in wordpress

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?

like image 232
SergeevDMS Avatar asked Mar 28 '26 20:03

SergeevDMS


1 Answers

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' );
like image 128
Kevin Leary Avatar answered Mar 31 '26 13:03

Kevin Leary