Title: Remove Shortcode Hook
Last modified: August 31, 2016

---

# Remove Shortcode Hook

 *  [AmandaEve](https://wordpress.org/support/users/amandaeve/)
 * (@amandaeve)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/remove-shortcode-hook/)
 * Is there a way I can set up a hook like this to remove a specific shortcode in
   20 seconds?
 * I found this code online … but I don’t know how to execute it. I’ve added it 
   to the functions.php … but I’m not sure what to replace wp_footer with.
 *     ```
       add_action( 'wp_footer', 'remove_content_timer' );
       function remove_content_timer() {
       	?>
       	<script type="text/javascript">
   
       	setTimeout(function() {
       		// run the necessary javascript to remove the content
       	}, 20000); // run function after 20000ms
   
       	</script>
       	<?php
       }
       ```
   

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

 *  [ancawonka](https://wordpress.org/support/users/ancawonka/)
 * (@ancawonka)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/remove-shortcode-hook/#post-7019729)
 * is the JavaScript showing up at the bottom of your source code?
 * If so, then you need to write some JavaScript code to remove the content from
   the page.
 * This would replace the comment that says ‘// run the necessary javascript to 
   remove the content’ with the correct code.
 *  Thread Starter [AmandaEve](https://wordpress.org/support/users/amandaeve/)
 * (@amandaeve)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/remove-shortcode-hook/#post-7019776)
 * Sorry – I’m not sure what you mean.
 * I thought I’d add that code to the functions.php file. and then somehow call 
   it from my posts or pages.
 * I was wondering how I’d call it.
 * If I have a piece of shortcode that shows an image, but I wanted the image to
   go away after 20 seconds.
 * What would I put in the actualy page to remove that shortcode?
    ex: `[remove_content_timer][
   show image="image.gif"][/remove_content_timer]`
 * note: I’m sorry – I’m clueless.
 *  Thread Starter [AmandaEve](https://wordpress.org/support/users/amandaeve/)
 * (@amandaeve)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/remove-shortcode-hook/#post-7019798)
 * could I use this in wordpress?
    `http://jsbin.com/aguyuw/1/edit?html,js,output`
 *  [ancawonka](https://wordpress.org/support/users/ancawonka/)
 * (@ancawonka)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/remove-shortcode-hook/#post-7019803)
 * Hmm. A shortcode in WordPress is used to output HTML into the page. So, when 
   you put a shortcode like [gallery id='1,2'] (the WordPress Shortcode to insert
   a gallery from the Media Library) it outputs a bunch of html. If you do a “view
   source” you can see what that HTML looks like.
 * The JSbin code you pasted would work – but you’ll need to figure out what the
   HTML is that is being output by the shortcode, and you’ll then need to address
   that DOM element and remove it from the page.
 * This line here:
 * `$('#target').remove();`
 * Removes the following HTML:
    `<p id='target'>Foobar</p>`
 * But you’ll have to figure out the SPECIFIC HTML in YOUR page to remove.
 *  Thread Starter [AmandaEve](https://wordpress.org/support/users/amandaeve/)
 * (@amandaeve)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/remove-shortcode-hook/#post-7019809)
 * oh. thanks. I’ll maybe look for another option. #OverMyHead

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

The topic ‘Remove Shortcode Hook’ is closed to new replies.

## Tags

 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [hook](https://wordpress.org/support/topic-tag/hook/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 5 replies
 * 2 participants
 * Last reply from: [AmandaEve](https://wordpress.org/support/users/amandaeve/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/remove-shortcode-hook/#post-7019809)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
