• There are some posts on our website that use features not supported by Instant Articles, like sliders from Nextend SmartSlider3 plugin.

    Since they’re a relevant part of the post, we chose to block them from being submitted to IA, using the instant_articles_should_submit_post:

    add_filter( 'instant_articles_should_submit_post', 'custom_instant_articles_should_submit_post', 10, 2 );
    
    function custom_instant_articles_should_submit_post($should_show, $IA_object) {
      if ($should_show) {
        $post = get_post($IA_object->get_the_id());
        if (strpos($post->post_content, '[smartslider') !== FALSE) {
          $should_show = FALSE;
        }    
      }
      return $should_show;
    }

    Not a fancy solution, but it should be working, as the following message appears on the post edit screen:

    This post will not be available as Instant Article due to a rule created in your site.

    However, the post was published to IA, regardless of the message.

    Am I missing something?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Contributor Gary Jones

    (@garyj)

    Not sure I can add much, but the code looks correct.

    Where was the code written? I wonder if it was tucked in a theme, and therefore not run until after post_updated, save_post, or similar hook had already been called. You may want to try moving it into an mu-plugin file or hooking the whole filter call and call back to an early priority of init.

Viewing 1 replies (of 1 total)
  • The topic ‘Is instant_articles_should_submit_post really working?’ is closed to new replies.