Publicize is one of the modules of the popular Jetpack plugin which is now renamed as Jetpack Social. This enables automatic sharing of WordPress blog posts in social platforms whenever you publish posts first time. Since Jetpack has multiple other modules like Site Stats, Uptime Monitoring, Content Recommendations, Sharing Buttons, etc. It is an easy way for WordPress site owners to choose Jetpack Social connections module for auto sharing of posts. However, the problem comes when the plugin shares the shortlink or ugly URL instead of the beautified permalinks. In this article, we will explain a quick fix for this and show the easy to remember permalinks in social feeds.
Jetpack Social Connections
Publicize or Jetpack Social Connections module allows to connect to four social sharing sites – Facebook, Twitter, LinkedIn and Tumblr. By default, the sharing option is disabled due to privacy reasons. You can enable it by navigating to “Jetpack > Settings > Sharing” section and turn on “Automatically share your posts to social networks” option.
After that click on “Connect your social media accounts” link to go to your WordPress.com account. There you can enable the required social networks by clicking on “Connect” button.
The advantage using Jetpack is that the connections can be shared among administrators, editors, contributors and other user groups.
Default Sharing of Ugly Shortlinks
Once the plugin is installed and the module is activated, the blog posts during first time publishing will automatically be shared on all connected social accounts. The problem here is that the shared post URL will be the ugly WordPress URL like “yoursite.com/p?123” instead of the URL with the description (or the option you have chosen for your URL permalinks). Below is the post shared by Jetpack on Facebook showing the permanent URL with post number:
The ugly URL is being shared on all connected social accounts like Facebook, Twitter and LinkedIn.
How to Share Pretty Permalinks URL?
In order to fix the issue and share the pretty permalinks URL, add the below code in “functions.php” file of your theme. We explain here to edit the file in admin panel. However, you can either use FTP or File Manager app hosting account and navigate to the active theme folder to locate “functions.php” file.
- Go to “Appearance > Theme File Editor” section in your admin dashboard.
- Select your active theme from the list and click “Select” button.
- Next, select “Theme Functions” file (functions.php) to open its content in the editor.
- Paste the below code at the end of the file.
- Click “Update File” button to save your changes.
function tweakjp_cust_shortlink() {
global $post;
if ( !$post )
return;
return get_permalink($post->ID);
}
add_filter( 'get_shortlink', 'tweakjp_cust_shortlink' );
It should look like below in your editor.
Ensure not to leave any blank spaces at the last line. Henceforth all new blog posts published will be shared with the pretty permalinks URL as shown below:
Remember “functions.php” file will be overwritten whenever you update the theme. Hence you need to add the above code every time after updating your theme. Otherwise, we recommend using a child theme or code snippets plugin to edit functions.php file.
Note: Jetpack also offers Jetpack Social as a separate plugin. The above solution works only when you use Social Connections module in Jetpack plugin and not with separate plugin.
Leave a Reply
Your email is safe with us.