Converting hashtags in posts to WordPress Tags. This code works only for web WP Admin posts; can it be modified to work for Jetpack official mobile app posts?

**Desired outcome:**
Converting hashtags within post content to WordPress tags using mobile apps (and not just web admin posts)?

The following code ([sourced from stack overflow]( works when posting from web WP Admin Backend, can it be modified to also work when posting from official mobile apps such as ‘Jetpack App’ and ‘WordPress App’?

function post_published_notification( $ID, $post ) {
$content = $post->post_content;
preg_match_all(‘/( #\w+)/’, $content, $matches, PREG_PATTERN_ORDER);
foreach($matches[1] as $matchKey){
wp_set_post_tags( $ID, trim($matchKey), true);
add_action( ‘publish_post’, ‘post_published_notification’, 10, 2 );

What are your thoughts? Possible?

  1. I’ve never used Jetpack, so I’m not sure how posts are being handled using it. A quick search gave me the following article, but I’m not sure if it’s helpful for you: [Jetpack Content Options]( If it’s not the case yet, it could be that you have to enable theme support.

    My other guess is that a custom post type is being used that doesn’t respond to the specific function. If you’re able to provide us with a link of a post you’ve created using Jetpack, I can checkout the source code to see the post type.

  2. You’ll want to have that same action fire when a post is created through the REST API, that’s what the apps use.

    Add this below the existing action, it should work for what you want:

    add_action( ‘rest_after_insert_post’, ‘post_published_notification’, 10, 2 );


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer