WebMatros

Spread Your Wings Online

  • Reviews
  • Resources
  • About

WordPress Jetpack Publicize for Custom Post Types

This is a short blog post, to quickly share with you how to enable automatic social media sharing of custom post type content, in WordPres, via the Jetpack plugins’ Publicise module.

In case you don’t know what the WordPress Jetpack plugin is – and what its Publicize module does – here’s a short backstory: the Jetpack WordPress plugin is a bunch of mini-plugins (called modules) bundled together in one rather awesome WordPress plugin. It’s made by Automattic, the commercial company backing WordPress. They also run WordPress.com – the official, hosted WordPress solution. And that’s how the Jetpack plugin came to fruition: it’s a plugin offering some of the innovations and features from WordPress.com to be used on self-hosted WordPress sites and blogs.

Jetpack is definitely one of the best WordPress plugin. I consider it essential to any WordPress installation! Apart from the Publicise module, you also get:

  • Simple statistics, right there in your WordPress dashboard.
  • Social sharing buttons that work as intended.
  • Spellchecking that warns you about clichés, hidden verbs, complex language, and more.
  • Image carousel and fashionable tiled image galleries.
  • And sooo much more!

Anyway, to cut a long story short:

I just spend some time activating the Publicize module in the Jetpack plugin and subsequently enabling / setting up the various connections to my Google+, Facebook, Twitter, LinkedIn profiles… and even creating a Path account! Gotta keep up with the Joneses you know! Heck, I even resurrected my old Tumblr profile:) Feel free to befriend me by the way!

But when I went to one of my custom post types… Keine (nada) Publicize settings there! So I started running home to ask my all-knowing bigbrother Google for help.

But did he have an answer? No, not a clear one. Most of the results were forum threads, and most of them dead ends, albeit promising ones at that. So I was ready to abandon my mini-project of getting my custom post types automatically shared via Jetpack’s otherwise neat Publicize module.

But then I found a forum post at the WordPress.org forums, only 1 (one!) day old, announcing:

Hi!

An update to let you know that since Jetpack version 2.8, you cnan now add Publicize support to your Custom Post Types:

http://jetpack.me/2014/01/31/jetpack-2-8-introducing-markdown-and-improving-monitor/

Richard Archambault

Rejoice! Happy dance! And waddya know? It even works!

Simply add publicize to the “supports” array of your custom post type, in the functions.php file, found in your theme folder (provided you’ve created your custom post type there).

Like this:
‘supports’ => array ( ‘title’, ‘editor’, ‘excerpt’, ‘publicize’, ‘thumbnail’, ‘comments’, ‘revisions’, ‘custom-fields’, ‘page-attributes’, ),

And then it works:)

WordPress Jetpack Publicize for custom post types

Related

Reviewed by Johnny Livingston★Updated in

Comments

  1. Lucie says

    October 24, 2021 at 14:38

    Hello,

    Thank you for this tutorial, but for me, that doesn’t work…

    Thanks to this code, I display the metabox in the editor for my custom post type, but when I click Publish, my customize post type is not visible on my Facebook page 🙁

    Reply
  2. Norbert says

    October 21, 2017 at 18:49

    Hi Oliver,

    Thanks for this tutorial. I followed it to enable Jetpack publicize for my custom post types and it works perfectly.

    Reply
    • Oliver Nielsen says

      October 22, 2017 at 22:32

      Hey Norbert

      You’re welcome:)

      Oliver

      Reply
  3. Bang Nguyen says

    June 30, 2017 at 05:17

    Is there anyway to disable publicize feature for custom post type. My site has several post type but I only want to publish normal post to Social networks.

    Reply
  4. Andi Wilkinson says

    June 29, 2017 at 21:00

    Thanks for that! so simple.. .

    Reply
  5. Tuluzz says

    March 1, 2017 at 09:06

    Hi Oliver,

    I am using 4 Different Custom Post types – Hardware, Gadgets, Softwares and one more.

    But these post types are not created manually but by a 3rd party plugin called – Toolset Types.

    So, I am not able to exactly follow the process, how to add support for Jetpack Publicize to custom post types in this case?

    Can you please help me out?

    Reply
    • Oliver Nielsen says

      March 13, 2017 at 22:17

      Hey Tuluzz

      Have you tried asking the Toolset Types developers? That may easily be able to help you with it.

      =)
      Oliver

      Reply
    • Kalle Kallovsky says

      July 2, 2021 at 09:55

      Even if this comment is a few years old, for me this thread was still useful. And in case somebody stumbled into the same problem as you do, just use this function instead to add the “publicize” functionality after the custom post type was added:

      add_post_type_support(‘my_custom_post_type’, ‘publicize’);

      The whole call with hooking in for your functions.php could look like this:

      add_action(‘init’, ‘add_publicize_to_my_custom_post_type’);
      if (!function_exists(‘add_publicize_to_my_custom_post_type’)) {
      function add_publicize_to_my_custom_post_type(){
      add_post_type_support(‘my_custom_post_type’, ‘publicize’);
      }
      }

      Reply
      • Oliver Nielsen says

        July 2, 2021 at 22:28

        Hey Kalle

        Thank you so much for sharing that helpful tip. Very gracious of you!

        May you have a truly blessed day:)
        Oliver

        Reply
  6. Heather says

    June 23, 2016 at 14:31

    Ugh. This actually broke my site. 🙁 I guess they didn’t fix it as well as they thought they did.

    Reply
  7. Sarah says

    June 22, 2016 at 19:26

    Exactly what I was looking for! Thank you!

    Reply
  8. Syl says

    June 10, 2016 at 11:47

    Hello every one,

    That you for this post but i still can’t display sharing icons on my custom post types with jetpack.

    I added ‘publicize’ tu the line “supports” of my custom post type but did not change anything.
    Isn’t there a code to writ in the template that displays the specific custom post type ?
    For example, to get the title form an article, you need to write . Is there a line to insert so ?

    Thank you very much for your help.

    Reply
    • Oliver Nielsen says

      June 16, 2016 at 11:19

      Hey Syl

      The Publicize module doesn’t add sharing icons – it adds auto-sharing of your post, once it gets published. For sharing buttons you need to activate that other module;)

      Oliver

      Reply
  9. Rahul Negi says

    April 28, 2016 at 08:24

    Simple do changes in this file if you want to remove publicize from wp default posts:

    On line 6480

    function post_type_is_publicizeable( $post_type ) {
    if ( 'post' == $post_type )
    return false; // make it false
    if ( 'custom-post-type1' == $post_type )
    return true; // make it true for cpt

    if ( 'custom-post-type2' == $post_type )
    return true;// make it true for cpt

    return post_type_supports( $post_type, 'publicize' );
    }

    Thanks and enjoy open source

    Reply
    • Rahul Negi says

      April 28, 2016 at 08:25

      file name is: jetpack/modules/publicize/publicize.php

      Reply
    • Rahul Negi says

      April 28, 2016 at 08:25

      You have to change on this file: jetpack/modules/publicize/publicize.php

      Reply
  10. Robert Harper says

    January 17, 2016 at 12:50

    If you want Publicize to work with a custom post type that is being set by a plugin then you can use this code in your functions.php file to add the support for that post type:

    add_action(‘init’, ‘my_custom_init’);
    function my_custom_init() {
    add_post_type_support( ‘custom_post_type’, ‘publicize’ );
    }

    Reply
    • Oliver Nielsen says

      January 29, 2016 at 19:29

      Thanks for sharing Robert! Kind of you!

      =)
      Oliver

      Reply
    • Simon Wood says

      April 13, 2016 at 17:42

      Thanks Oliver & Robert both – these snippets are exactly what I needed (with both my own & 3rd party custom post types).

      Reply
      • Oliver Nielsen says

        April 13, 2016 at 21:47

        You’re welcome Simon! Thanks for letting us know!

        =)
        Oliver

        Reply
        • Josh says

          April 14, 2016 at 16:36

          Hello, I used your little snippet code to add the publicize to Add Job section in WP Job Manager, but publicize is still not working. The plugin itself has publicize enabled in its functions ‘supports’ section but its not showing up on the add job section,. and I have checked that jetpack publicize is enabled and I have a 2 shared connections linkedin and twitter, I know its working because it shows up on add post but not add job, any ideas ?

          Reply
          • Oliver Nielsen says

            April 20, 2016 at 20:05

            Hey Josh

            Sadly not. I’m not using Jetpack myself any longer, as my site is on the Rainmaker Platform (a hosted, customized WordPress-based platform) so I can’t readily test it.

            my best guess would be a clash of function-names the PHP, or something similar. Also keep an eye on the JS console in the developer tools in your browser – it may have some clues.

            Have you tried talking to WP Job Manager’s support/developers? It may be something particular to that plugin.

            =)
            Oliver

            Reply
  11. Tan0 says

    December 10, 2015 at 13:16

    THANK YOU!

    This saves me so much time!

    Reply
  12. Alinn says

    October 12, 2015 at 15:04

    Hi
    Thanks
    🙂

    Reply
  13. Andrew says

    September 7, 2015 at 23:39

    Anyone know how to take this solution and apply it to the Webcomic plugin using the inkblot theme? I can’t publicize my webcomics.

    Reply
  14. Spadequa says

    August 30, 2015 at 11:43

    Worked perfectly. You are a prince.

    Reply
  15. Nick says

    April 29, 2015 at 04:35

    I am trying something simpler–add the Jetpack publicize box to “Pages” and not just to posts. Pages aren’t set up as a custom post type, but it should be similar. Can you help me out with what I would add to functions.php?

    Reply
    • Joe says

      October 15, 2015 at 22:01

      I believe you can accomplish this using the settings found under Dashboard>Settings>Sharing. There is a series of checkboxes at the bottom of the page to activate and deactivate the share box on various types of content.

      Reply
  16. Bridget says

    February 11, 2015 at 18:31

    Thanks! This is exactly what I needed to get Publicize working with a custom post type. This saved me a lot of time.

    Reply
    • Oliver Nielsen says

      February 12, 2015 at 12:54

      Glad to hear it was of Help Bridget!

      =)

      Reply
  17. Hakob says

    February 5, 2015 at 15:00

    Hi,
    I tried to find out how to put it in Place with the Realhomes Template, but no Solution.
    Do you have a hint or solution how to get that doen?
    Hakob.

    Reply
    • Oliver Nielsen says

      February 8, 2015 at 22:51

      Hello Hakob

      Nope, not familiar with that theme. But if there isn’t a functions.php file in your themes root folder, you create it there, or make a child theme and create it there:)

      Oliver

      Reply
  18. Chathuranga Arambewela says

    July 12, 2014 at 20:40

    Thanks a lot for the tip, mate. ! ive been looking all over the net to find a solution for this. it works like a charm. Thanks again. !

    Reply
  19. ed says

    May 27, 2014 at 14:40

    Good man just what I was looking for. Will try it now.

    Reply
  20. Cesar Falcao says

    March 4, 2014 at 04:06

    Hi Oliver. Maybe I´m a little slow, but what all this about? Publicize feature is that our post go published to any social network set up, so whats this procedure you teach us makes?

    Reply
    • Oliver Nielsen says

      March 4, 2014 at 22:10

      It enables Publicize for custom post types.

      Reply
      • cesarfalcao says

        March 6, 2014 at 03:45

        Can you please give a example of what we can achieve with that?

        Reply
        • Oliver Nielsen says

          March 7, 2014 at 21:36

          You can auto-share custom post type content:) Simple as that.

          The Publicize module in Jetpack does not work with custom post types, unless you do what I describe in the blog post.

          Reply
      • Brian Reich says

        September 20, 2015 at 23:11

        Thanks for blogging this! You just saved me a ton of time digging through Jetpack’s code to figure this one out 🙂

        Reply
        • Oliver Nielsen says

          September 21, 2015 at 11:25

          You’re welcome Brian!

          Reply

Questions or comments? Feel free: you're welcome!Cancel reply

Divi 4 by Elegant Themes

ActiveCampaign banner – Start Growing Your Business Today

  • Terms & Conditions
  • Affiliate Disclosure
  • Contact

WebMatros © 2009–2023 – WordPress & Genesis on Media Temple