Title: execute the_content after shortcode
Last modified: April 5, 2020

---

# execute the_content after shortcode

 *  Resolved [jaapmarcus](https://wordpress.org/support/users/jaapmarcus/)
 * (@jaapmarcus)
 * [6 years ago](https://wordpress.org/support/topic/execute-the_content-after-shortcode/)
 * Currently I am using WordPress and host some video’s on it
 * Due to heavy 3rd party stealing I have decided to enable Nginx Secure Links
 *     ```
       		function my_function($content){
       $new_content = preg_replace_callback('/https?.([^ ]*)?\.('.implode('|',explode(',',$this -> options['extensions'])).')/', array($this, 'convert'), $content);
       	return $new_content ;		
       		}
   
       add_filter('the_content', 'my_function',99);
   
       function secure_url($url, $path){
       	    		$expires = time() + $this -> options['ttl'];
       	    		$secret = $this -> options['secret'];
       			$md5 = md5("$expires$path $secret", true);
       			$md5 = base64_encode($md5);
       			$md5 = strtr($md5, '+/', '-_');
       			$md5 = str_replace('=', '', $md5);
   
       			//var_dump($url . $path . '?md5=' . $md5 . '&expires=' . $expires);
       			return $url . $path . '?md5=' . $md5 . '&expires=' . $expires;
   
   
       		}
       ```
   
 * This return a url
 * [https://website.nl/pathtovideofile.mp4?md5=](https://website.nl/pathtovideofile.mp4?md5=){
   string}&&expires={time()+ttl}
 * When using Gutenberg Blocks this works fine how ever when using the Classic editor(
   With shortcodes) this will break See below the output
 * `<video class="wp-video-shortcode" id="video-1372-1_html5" width="640" height
   ="360" poster="https://website.nl/wp-content/uploads/2020/03/big_buck_bunny.jpg"
   preload="metadata" style="width: 640px; height: 360px;" src="https://website.
   nl/wp-content/uploads/2020/03/big_buck_bunny.mp4?md5=9-NRRzjHR22W9s1CVsJ5Fg&expires
   =1586083573?_=1"><source type="video/mp4" src="https://website.nl/wp-content/
   uploads/2020/03/big_buck_bunny.mp4?md5=9-NRRzjHR22W9s1CVsJ5Fg&expires=1586083573?_
   =1"><source type="video/webm" src="https://website.nl/wp-content/uploads/2020/
   03/big_buck_bunny.webm?md5=DhuI17PSLcOjM0J_C0laeA&expires=1586083573?_=1"><a 
   href="https://website.nl/wp-content/uploads/2020/03/big_buck_bunny.mp4">https://
   website.nl/wp-content/uploads/2020/03/big_buck_bunny.mp4?md5=1-J8b6nfvJ68SU_fngqasA&
   expires=1586083573</a></video>`
 * Is it possible to execute the add_filter(‘the_content’, ‘my_function’,99); after
   the wp_video_shortcode function?
 * It breaks on the
 * `$type = wp_check_filetype( $atts['src'], wp_get_mime_types() );`
    -  This topic was modified 6 years ago by [jaapmarcus](https://wordpress.org/support/users/jaapmarcus/).

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

 *  [crstauf](https://wordpress.org/support/users/crstauf/)
 * (@crstauf)
 * [6 years ago](https://wordpress.org/support/topic/execute-the_content-after-shortcode/#post-12631061)
 * The shortcode for video embeds appears to run on `the_content` with a priority
   of `8`. I think you want to run your function before the video embed shortcode
   is run, not after: try setting your callback priority to `7`, and see what happens.
 *  Thread Starter [jaapmarcus](https://wordpress.org/support/users/jaapmarcus/)
 * (@jaapmarcus)
 * [6 years ago](https://wordpress.org/support/topic/execute-the_content-after-shortcode/#post-12632207)
 * I finally fixed it by altering the regex code
 * `/src="?([^ ]*)?\.('.implode('|',explode(',',$this -> options['extensions'])).')([
   ^ ]*)"/`
 * And run the code after the wp_video_shortcode
 * 2nd problem was that my changed wp_video_shortcode ran as the default setting
   causing it mainly the problems

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

The topic ‘execute the_content after shortcode’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [jaapmarcus](https://wordpress.org/support/users/jaapmarcus/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/execute-the_content-after-shortcode/#post-12632207)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
