Adrotate shortcode not triggered when post is loaded via ajax

Home Forums AdRotate for WordPress Bug Reports Adrotate shortcode not triggered when post is loaded via ajax

This topic contains 4 replies, has 2 voices, and was last updated by  Arnan 1 year, 2 months ago.

  • #39066

    crissoca
    Badges:

    I’m working on a site that it’s using the adrotate if I load a post directly the shortcode works, but if I load the article via ajax using a infinite scroll plugin it does not trigger the shortcode it passes it as plain text.

    The only weird thing is that only the adrotate shortcode is not working, I have other shortcodes running in there and they all work fine.

    #39124

    crissoca
    Badges:

    So I think I got an idea, the problem is that this plugin’s shortcode is registered under a conditional !is_admin() so if it’s run by admin-ajax.php it won’t be triggered.

    #39137

    Arnan
    Badges:

    Could be, did you try that out further?
    Or if not, can you try it by moving the shortcode thingy outside the if().

    I don’t have a suitable theme to test out the theory.

    #39159

    crissoca
    Badges:

    Hey, yes, that did the trick I would pull up a merge request but I wasn’t sure if that was intentional for a reason.

    If I remove the add_shortcode() outside the if( !is_admin ) conditional it works via admin-ajax.php and it makes sense since admin-ajax.php is well inside the admin.

    #39356

    Arnan
    Badges:

    Merge request?

    I’ll look into moving the shortcode outside the if().
    Which plugin are you using for the infinite scroll feature?

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Adrotate shortcode not triggered when post is loaded via ajax’ is closed to new replies.