A
A
av_tyschenko2016-03-06 09:02:19
JavaScript
av_tyschenko, 2016-03-06 09:02:19

Why don't shortcodes work after AJAX load?

Good afternoon) Question for connoisseurs! We are setting up the topic, the question arose, the shetcodes from CF7 work when unloading AJAX, but the shetcodes from Visual Composer do not work.

AJAX handler:

<?php

function handler_get_work() {

    global $post;
    $args = array(
        'posts_per_page' => 1,
        'post_type' => 'portfolio',
        'p' => (int) $_POST['id']
    );

    $single_work = get_posts( $args );
    foreach ( $single_work as $post ) : setup_postdata( $post );
        echo '<h1>' . get_the_title() . '</h1>';
        the_content( __( 'Read More', 'atrium_theme_core' ));
        wp_link_pages();
    endforeach;
    wp_reset_postdata();

    die();
}

add_action('wp_ajax_get_work', 'handler_get_work');
add_action('wp_ajax_nopriv_get_work', 'handler_get_work');

?>


Perhaps AJAX can somehow be registered in a different order so that it runs after Visual Composer, but to be honest, it's not clear. Tried init, and set priorities, did not help (

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question