Remove and restore one shortcode

Another old unanswered question. Hopefully useful to someone in the future.

WordPress stores shortcode tags and callbacks in the $shortcode_tags. This is how I’d do it.

function my_the_content( $content ) {
  global $shortcode_tags;

  $tag= 'some_shortcode';

  //* Make sure it's actually a valid shortcode
  if( ! isset( $shortcode_tags[ $tag ] ) ) {
    return $content;
  }

  $func = $shortcode_tags[ $tag ];
  remove_shortcode( $tag );

  //* Do something useful

  //* Restore the shortcode
  add_shortcode( $tag, $func );

  return $content;
}