WordPress: re-enable Publicize for already published posts via Jetpack Publicize

Wordpress: condividere nuovamente gli articoli condivisi con Jetpack Publicize

If you use WordPress and you do not know the Jetpack plugin we can’t help but recommend you to fill this huge gap by reading the excellent guide on sos-wp.it or, if you prefer, by directly going to the official Jetpack website. I’ll just say that we’re talking about a very powerful (and very useful) plugin that will empower your WordPress-enabled website with a lot of useful features, most of them identical to those available to WordPress.com paid accounts.

If you stumbled across this article is however likely that you know very well not only Jetpack but also one of its most interesting modules: I’m talking of Publicize, which gives us the power to automatically share our WordPress posts over the most popular Social Networks: needless to say that, in order to use such feature we need to link our Social accounts to our WordPress + Jetpack installation, allowing the latter to publish to the former ones while using our identity.

The plugin work perfectly and it’s easy to configure. As soon as we activate it we’ll be able to link all our social accounts through its configuration screen:

publicize-options

If we do this, every time we’ll come to the point to publish a WordPress post we’ll be able to also publish that using our linked Social Networks accounts – and also choose a custom text, hashtags and/or URL – using a handy Widget that will be added to those already present in the right column:

publish-meta-publicize

The only limitation so far is that Publicize module does not allow you to share already published posts. This restriction applies not only to the post published before installing Jetpack and activating Publicize, but also for any post already published and/or shared by it. This basically means that you only have a single chance to do it in the right way: if you forget an hashtag or do any mistake you won’t be able to recover. The next time you’ll try to edit an already-published post you’ll see that the Publicize checkboxes of each linked Social Network will be unselected and disabled, making it impossible to select them again.

The solution

Fortunately the issue can be fixed with a simple workaround, provided you have access to the filesystem that hosts our WordPress website: that’s because we’ll need to apply a small code change to one of the .php module files. The file we need to edit is the following:

Open the file with a text editor and find the following line of code (usually around line 540, depending on the installed Jetpack version):

Immediately below this line you need to add the following:

This fix will disable the checks whether the current post has already been published or not. Once done, all you need to do to re-enable Publicize settings is to change the status of any post from Published to Draft and then click Update: as soon as the page reloads itself you’ll be able to publish the post while specifying all the Publicize options you want to perform.

UPDATE: If you want to make Publicize to automatically add some hashtag to your posts without having to manually insert them every time, check out this plugin.

That’s all for now. Happy coding!

 

About Ryan

IT Project Manager, Web Interface Architect and Lead Developer for many high-traffic web sites & services hosted in Italy and Europe. Since 2010 it's also a lead designer for many App and games for Android, iOS and Windows Phone mobile devices for a number of italian companies. Microsoft MVP for Development Technologies since 2018.

View all posts by Ryan

12 Comments on “WordPress: re-enable Publicize for already published posts via Jetpack Publicize”

  1. Pingback: Add hashtags in tweets sent with Jetpack Publicize
  2. Hi Ryan, I’m stoked you found a way to edit this problem of not being allowed to re=share a previously published post.

    And I tried your code:

    // We don’t allow Publicizing to the same external id twice, to prevent spam

    $service_id_done = (array) get_post_meta( $post->ID, $this->publicize->POST_SERVICE_DONE, true );

    But it didn’t work–gave me the “white screen of death”. Can you let me know when you fix this? I’d love to use it!

  3. I am also getting the white screen of death once I add the code as described. All I can do is remove it. Any ideas?

    1. Hello, your issue could be related to an older version of PHP by any chance? (see my other replies). Please try the following:

      $all_done = false; $service_id_done = false;

      Let me know if it fixed it.

      I updated the post as well, since this way to define vars is definitely safer than the previous one.

  4. I followed the steps as you mentioned here. Now the site isn’t working. I’m unable to revert back as I cannot to the site.
    “The http://www.XXX.com page isn’t working

    http://www.XXX.com is currently unable to handle this request.
    HTTP ERROR 500″

    1. Hello, I just tried my one-line code snippet (which is a very simple variable set) and it worked like a charm. The reason for your 500 could be the fact that you have an older version of PHP which doesn’t support multiple variable assignments at once.

      Please try the following. Instead of doing:

      $all_done = $service_id_done = false;

      try to do this:

      $all_done = false; $service_id_done = false;

      Let me know if it fixed it. Also ensure that there are no spaces between variable names, such as:

      $all__done

      which is something that could easily throw a 500.

      Thanks for sharing this with us. I updated the post as well, since this could be an issue for many readers.

  5. After adding the code the Publicize menu does allow me to check boxes but when I click Publish nothing happens on my social media! I’ve tried with a fresh test page (works) and I’ve tried editing the publish time on old posts (doesn’t work). Any ideas?

  6. Thanks Ryan, I am really surprise that why the past commentetors getting errors in using the above code.

    For me, it worked for my site https://www.elkeesmedia.com and I am really thankful to you to share this code with us.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.