WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
[resolved] Publicize works for regular post type, but doesn't for CPT (7 posts)

  1. Boris Kuzmanovic
    Member
    Posted 6 months ago #

    Hi,

    I have a custom post type (CPT) for printables on my site. After adding 'publicize' to my CPT definition I can see the options to auto-publicize to social networks when adding a new printable (as per this screenshot http://ow.ly/tf4cr). However, my CPT doesn't get publicized to social networks.

    Publicize still works for regular 'post' type.

    I confirmed that my CPT gets properly parsed by FB test tool.
    https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fkidspressmagazine.com%2Fprintable%2Fwow-2%2F

    This is my 'printable' CPT post:
    http://kidspressmagazine.com/printable/wow-2/

    This is a regular 'post' type post:
    http://kidspressmagazine.com/testing-post-type/

    My Facebook test page shows a regular post but not a CPT post:
    https://www.facebook.com/pages/Kids-Press-Magazine/574514339262788

    https://wordpress.org/plugins/jetpack/

    My site runs on WP 3.8.1 and Jetpack 2.8. I use Pods plugin to create CPTs.

  2. Richard Archambault
    Happiness Engineer
    Plugin Author

    Posted 6 months ago #

    Hi!

    Have a look here:

    https://github.com/Automattic/jetpack/issues/8

    As mentioned in this comment, your CPT needs to be added with a priority of less than 10. This will be fixed in the next update to Jetpack, but meanwhile, changing your CPT's priority to less than 10 should make it work.

    Try that and let me know!

  3. Boris Kuzmanovic
    Member
    Posted 6 months ago #

    Pods plugin does all the CPT work for me. I looked at it and it seemed a little complex to modify. Instead, I applied the one line patch (URL below) to Jetpack and it worked great.

    https://github.com/Automattic/jetpack/commit/5870427825dca7e42c9ad89b5b68cf79226442bf

  4. Scott Kingsley Clark
    Member
    Posted 6 months ago #

    Pods does it's init at priority 10 like most plugins are told to do for registering post types and taxonomies. If Jetpack then adds it's init at priority 10, supposing it runs before plugins named by alphabetic characters after the letter J or after the word Jetpack, then those plugins will be left out of inclusion here, for their registered post types. It would then be good, to have a higher priority set for 'init' in this case, for Jetpack to have access to all registered post types, but I'm not sure "999" should be used here, perhaps 12, 15, 20 something like that would be much more sane. "999" just exacerbates the problem and escalates priorities in cases where someone wants to customize around hooks further. But that's not your issue :)

  5. Richard Archambault
    Happiness Engineer
    Plugin Author

    Posted 6 months ago #

    @Scott: you make a good point; we'll see what the developers have to say about it. Mind raising the point on the issue?

  6. Brandon Kraft
    Happiness Engineer
    Plugin Author

    Posted 6 months ago #

    Hi Scott,

    Please do raise the issue on the GH issue (I'm just another HE, not one of the JP devs). That particular action, I would think, should never need to be out-prioritized (as there are other, more desirable ways to programmatically un-publicize something that is set to publicize), but looking to make sure everything has had a chance to load before we setup the syncing.

    That said, is there a better hook than init to hook onto to avoid a high priority number? Is this the best practice on how to run an action that expects to be ran after everything else it setup? Fodder for a good discussion.

  7. Scott Kingsley Clark
    Member
    Posted 6 months ago #

    Init action should be fine, just set priority to something like 11-20 so plugins have a chance to register their post types.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags