raffaelefranco
Forum Replies Created
-
Yes, the scheduled posts get publicized but with no hashtags.
And i’m using now the original code:function jeherve_publicize_hashtags() { $post = get_post(); if ( ! empty( $post ) ) { // Grab the tags of the post $post_tags = get_the_tags( $post->ID ); // Append tags to custom message if ( ! empty( $post_tags ) ) { // Create list of tags with hashtags in front of them $hash_tags = ''; foreach( $post_tags as $tag ) { $hash_tags .= ' #' . $tag->name; } // Create our custom message $custom_message = get_the_title() . ' ' . $hash_tags; update_post_meta( $post->ID, '_wpas_mess', $custom_message ); } } } // Save that message function jeherve_cust_pub_message_save() { add_action( 'save_post', 'jeherve_publicize_hashtags' ); } add_action( 'publish_post', 'jeherve_cust_pub_message_save' );Hello.
I would like to update this thread.
Yes, i found out why the code wasn’t working.I have another problem: it doesn’t work with scheduled posts.
If i create a post (with tags), and publish immediately it works fine. If i decide to schedule the post (most of the time it’s necessary for my sites) the code doesn’t work.Is there any way to make it works even on scheduled posts?
FIGURED OUT WHAT HAPPENS.
Can’t explain how or why, but your code works IF i don’t click on “Edit Details” in the Publicize area on the post editor.
If i click on “Edit Details”, it shows me the Custom Message preview with no hashtags, and it apparently saves it and prevent the code to “work” properly.But if i DON’T click on that (my mistake, all the time i checked it before to publish) and create (even from drafts) and publish, it works!
Just an update.
It doesn’t work on a fresh new wordpress installation anymore.
Can’t say why, what i do is just copy and paste your code, Jeremy, into the functionality plugin, it worked this morning, can’t figure out why it doesn’t work now.The only installed plugins are:
Akismet (inactive)
Functionality
Hello Dolly (inactive)
JetpackThe theme is Fifteen (the default one) as well as WordPress version is 4.2.2 .
What i did:
Installed WordPress, installed Functionality first and Jetpack then.
Connected Jetpack to WordPress.com (using my default account), configured Publicize connecting my Twitter account.
Added your code to Functionality. Saved and activated the function plugin generated.
Added a new post, with a title, few words content, three tags.
Published it.On twitter i see only the title and the link (twice, but it’s another problem you’re already dealing with) with no tags as hashtags.
Where is the problem? Is there a way to figure out?
Thank you for your fast reply, Jeremy.
I managed to make your (original) code to work on a fresh new wordpress installation, with only Jetpack and Functionality installed as plugins. But it only worked publishing the new post directly, and not after i save it as draft, which is the way i work on WordPress, unfortunately.
Then i tried to deactivate all the plugins on one of my sites (a simple one), but your code doesn’t work.
As well as the other one you’ve provided.
It’s strange.
Are you able to use it correctly on any WordPress site you have?This function would boost the benefits of using Jetpack publicize instead of any other social sharing plugin.
Same here, having same problem.