title: WordPress - Overwriting a Shortcode
body: <p>I have a theme that extends the Visual Composer plugin with a slider on the front page. The slider will show five testimonials from five different customers. I want to add the featured image of each testimonial as the thumbnail in the slider. </p>
  
  <p>Here's the shortened code from the parent theme:</p>
  
  <pre><code>function jo_customers_testimonials_slider( $atts ) {
      extract( shortcode_atts( array( 'limit' =&gt; 5, "widget_title" =&gt; __('What Are People Saying', 'jo'), 'text_color' =&gt; "#000" ), $atts ) );
      $content = "";
      $loopArgs = array( "post_type" =&gt; "customers", "posts_per_page" =&gt; $limit, 'ignore_sticky_posts' =&gt; 1 );
  
      $postsLoop = new WP_Query( $loopArgs );
      $content = "";
  
      $content .= '...';
      $content .= '...';
      $content .= '...';
  
      wp_reset_query();
      return $content;
  }
  add_shortcode( 'jo_customers_testimonials_slider', 'jo_customers_testimonials_slider' ); 
  </code></pre>
  
  <p>My functions.php file:</p>
  
  <pre><code>function jo_customers_testimonials_slider_with_thumbnail( $atts ) {
      extract( shortcode_atts( array( 'limit' =&gt; 5, "widget_title" =&gt; __('What Are People Saying', 'jo'), 'text_color' =&gt; "#000" ), $atts ) );
      $content = "";
      $loopArgs = array( "post_type" =&gt; "customers", "posts_per_page" =&gt; $limit, 'ignore_sticky_posts' =&gt; 1 );
  
      $postsLoop = new WP_Query( $loopArgs );
      $content = "";
  
      $content .= '...';
      $content .= get_the_post_thumbnail( get_the_ID(), 'thumbnail' );
      $content .= '...';
      $content .= '...';
  
      wp_reset_query();
      return $content;
  }
  add_shortcode( 'jo_customers_testimonials_slider', 'jo_customers_testimonials_slider_with_thumbnail' );
  </code></pre>
  
  <p>In theory, the function from my functions.php file should overwrite the shortcode from the parent theme. But nothing seems to happen when I use this code. What am I doing wrong?</p>
  
  <p><strong>Edit:</strong>
  <br>
  Tried this code, but it still won't work.</p>
  
  <pre><code>function wpa_add_child_shortcodes(){
  remove_shortcode('jo_customers_testimonials_slider');
      add_shortcode( 'jo_customers_testimonials_slider', 'jo_customers_testimonials_slider_with_thumbnail' );
  }
  add_action( 'after_setup_theme', 'wpa_add_child_shortcodes' );
  </code></pre>
  
  <p>Also changed 
  <br><code>add_action( 'after_setup_theme', 'wpa_add_child_shortcodes' );</code> to 
  <br><code>add_action( 'init', 'wpa_add_child_shortcodes' );</code>
  <br>, but no difference in the outcome.</p>
  
  <p><strong>Edit 2 (With Solution):</strong></p>
  
  <p>Changing <code>add_action( 'after_setup_theme', 'wpa_add_child_shortcodes' );</code> to <code>add_action( 'wp_loaded', 'wpa_add_child_shortcodes' );</code> solved it.</p>