Title: shortcode not working correctly
Last modified: August 22, 2016

---

# shortcode not working correctly

 *  Resolved [najmul002](https://wordpress.org/support/users/najmul002/)
 * (@najmul002)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/shortcode-not-working-correctly-3/)
 * I have multi paged post. many of them have google chart. I have used visuablizer
   plugin to integrate with google chart. It was working perfectly.
 * But, when I try to add ajax pagination it shows nothing! Just the shortcode itself.
 * I have applied “the_content” filter like:
 *     ```
       function ajax_load_page(){
       	$post_id = $_REQUEST['id'];
       	$page = $_REQUEST['page'];
   
       	$post = get_post($post_id);
   
       	$content = $post->post_content;
       	if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
       		if ( $page > 1 )
       			$more = 1;
       		$content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
       		$content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
       		$content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
       		// Ignore nextpage at the beginning of the content.
       		if ( 0 === strpos( $content, '<!--nextpage-->' ) )
       			$content = substr( $content, 15 );
       		$pages = explode('<!--nextpage-->', $content);
       		$numpages = count($pages);
       		if ( $numpages > 1 )
       			$multipage = 1;
       	} else {
       		$pages = array( $post->post_content );
       	}
       	$shortcode_content = $pages[$page - 1];
       	$shortcode_content = apply_filters( 'the_content', $shortcode_content);
   
       	$previous = false;
       	$next = false;
   
       	if(count($pages) > $page)
       		$next = $page + 1;
       	if($page > 1)
       		$previous = $page -1;
   
       	wp_send_json(array('previous'=>$previous, 'next'=>$next, 'content'=>$shortcode_content));
       }
   
       add_action( 'wp_ajax_load_page', 'ajax_load_page' );
       add_action( 'wp_ajax_nopriv_load_page', 'ajax_load_page' );
       ```
   
 * can you please what I am doing wrong?
 * [https://wordpress.org/plugins/visualizer/](https://wordpress.org/plugins/visualizer/)

The topic ‘shortcode not working correctly’ is closed to new replies.

 * ![](https://ps.w.org/visualizer/assets/icon-256x256.gif?rev=3084574)
 * [Visualizer: Tables and Charts Manager for WordPress](https://wordpress.org/plugins/visualizer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/visualizer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/visualizer/)
 * [Active Topics](https://wordpress.org/support/plugin/visualizer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/visualizer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/visualizer/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [najmul002](https://wordpress.org/support/users/najmul002/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/shortcode-not-working-correctly-3/)
 * Status: resolved