Title: Cannot redeclare has_shortcode WP 3.6.1
Last modified: August 21, 2016

---

# Cannot redeclare has_shortcode WP 3.6.1

 *  [Donorbrain](https://wordpress.org/support/users/donorbrain/)
 * (@donorbrain)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/cannot-redeclare-has_shortcode-wp-361/)
 * Hi there,
 * I’ve read some topics here about function has_shortcode creating an error once
   updating to wordpress 3.6.1 ,.. i’ve found the piece of code causing it in functions.
   php of my theme.
    However i need this code so i can’t just comment it out i decide
   it’s redundant. Can someone tell me how it should be rewritten?
 * Here it is:
 *     ```
       // check the current post for the existence of a short code
       function has_shortcode($shortcode = '') {
       		$post_to_check = get_post(get_the_ID());
       		// false because we have to search through the post content first
       		$found = false;
       	// if no short code was provided, return false
       	if (!$shortcode) {
       		return $found;
       }
       	// check the post content for the short code
       	if ( stripos($post_to_check->post_content, '[' . $shortcode) !== false ) {
       		// we have found the short code
       		$found = true;
       	}
       	// return our final results
       	return $found; }?>
       ```
   
 * Thanks a lot!

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

 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/cannot-redeclare-has_shortcode-wp-361/#post-4180487)
 * You just need to rename `has_shortcode` in functions.php to something unique (
   as of WordPress 3.6, it includes a function of the same name). Then you need 
   to update the add_action or whatever is calling your function to use the same,
   updated name.
 *  [Devin Lee](https://wordpress.org/support/users/d3vin/)
 * (@d3vin)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/cannot-redeclare-has_shortcode-wp-361/#post-4180913)
 * Hi man if you have **notepad++** or code editor, download the file, open the **
   function.php**.
    CTRL+F and replace the **has_shortcode** into **has_a_shortcode**
   or something else.
 * hope this help
 *  [Pathway_Design](https://wordpress.org/support/users/pathway_design/)
 * (@pathway_design)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/cannot-redeclare-has_shortcode-wp-361/#post-4180915)
 * Devin, you de mann! Just crashed my customer’s site [AlfaClear Drains](http://www.alfacleardrains.com/)
   and changing has_shortcode to has_a_shortcode worked perfectly to get it back
   up and running again!!
 * Thought I was going to have to spend the rest of the day getting it back up but
   this took seconds!
 * Thanks.
 *  [jinjuriki21](https://wordpress.org/support/users/jinjuriki21/)
 * (@jinjuriki21)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/cannot-redeclare-has_shortcode-wp-361/#post-4180925)
 * Awesome! Works like charm!
 * Thank you Scriptrunner (Doug Sparling) and Devin Lee.
 * Keep it up!

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

The topic ‘Cannot redeclare has_shortcode WP 3.6.1’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 5 participants
 * Last reply from: [jinjuriki21](https://wordpress.org/support/users/jinjuriki21/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/cannot-redeclare-has_shortcode-wp-361/#post-4180925)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
