Support » Plugin: OneSignal - Web Push Notifications » Sending the Category info from WordPress to iOS app

  • Just starting to set up OneSignal to send notifications to our iOS app. Within the app we need to open a different tab depending on which category the WP post is assigned to.

    I see I have to disable the ‘send notification to iOS automatically flag’ and set up a mu-plugin with

    <?php
    function onesignal_send_notification_filter($fields, $new_status, $old_status, $post)
    {
    $fields[‘isAndroid’] = true;
    $fields[‘isIos’] = true;
    $fields[‘isAnyWeb’] = false;
    $fields[‘isChrome’] = false;
    $fields[‘data’] = array(
    “myappurl” => $fields[‘url’]
    );
    /* Unset the URL to prevent opening the browser when the notification is clicked */
    unset($fields[‘url’]);
    return $fields;
    }

    How do we also include the category in the data sent?

    thanks

    Ellie

  • You must be logged in to reply to this topic.