Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter vmp584

    (@vmp584)

    I forget to mention that I’m making the call this way do_shortcode(“[connections]”)

    Plugin Author Steven

    (@shazahm1hotmailcom)

    @ vmp584

    The very likely reason the shortcodes are only registered with WordPress only in the sites frontend, not the admin. This was done to prevent theme’s and other plugins from running the [connections] shortcode in the admin specifically on the add/edit page/post screen.

    If you are using the WordPress AJAX API for your request, those happen while in context if being in the admin so the shortcodes will not be registered and therefore not run.

    There is a solution, in your AJAX callback you can register the shortcode before you use the do_shortcode() function. Use this code to register it:

    add_shortcode( 'connections', array( 'cnShortcode', 'view' ) );

    Hope that helps, let me know.

    Thread Starter vmp584

    (@vmp584)

    thank you very much, it works.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘short code in ajax’ is closed to new replies.