Title: Parse error in shortcode inserted into page
Last modified: August 22, 2016

---

# Parse error in shortcode inserted into page

 *  Resolved [dpurselle](https://wordpress.org/support/users/dpurselle/)
 * (@dpurselle)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/parse-error-in-shortcode-inserted-into-page/)
 * When I insert shortcode into a page using a plugin to insert PHP, I am getting
   a Parse error. The parse error occurs no matter which PHP plugin or WordPress
   theme is used:
 * Code on page:
 * [insert_php]
    echo do_shortcode(‘[pdb_list filter=”user_login=’ . $current_user-
   >user_login . ‘”]’); [/insert_php]
 * Page output:
 * Parse error: syntax error, unexpected ‘&’ in /home/content/01/12721101/html/CAG/
   wp-content/plugins/insert-php/insert_php.php(48) : eval()’d code on line 2
 * I can resolve the parse error by changing the multi-level quote structure (see
   below), but this coding does not allow the filtering to work – all users in the
   database are displayed rather then just the logged in user.
 * [insert_php]
    echo do_shortcode(“[pdb_list filter=\”user_login=’.$current_user-
   >user_login.’\”]”); [/insert_php]
 * I have tried using \” and \’ as a the first level quote and ” ‘ as the next 2
   levels, but this does not work either:
 * Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_STRING
   in /home/content/01/12721101/html/CAG/wp-content/plugins/insert-php/insert_php.
   php(48) : eval()’d code on line 2
 * The shortcode as originally written works fine when embedded directly into a 
   custom template. Any suggestions for coding using a plugin to insert PHP to avoid
   having to create a custom template for each new theme I try?

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

 *  [Mark Cahill](https://wordpress.org/support/users/lagmeister/)
 * (@lagmeister)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/parse-error-in-shortcode-inserted-into-page/#post-5267092)
 * Remove the echo. do_shortcode should render the result without it.
 *  Thread Starter [dpurselle](https://wordpress.org/support/users/dpurselle/)
 * (@dpurselle)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/parse-error-in-shortcode-inserted-into-page/#post-5267098)
 * That gave no error but caused no database items to be displayed.
 *  Thread Starter [dpurselle](https://wordpress.org/support/users/dpurselle/)
 * (@dpurselle)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/parse-error-in-shortcode-inserted-into-page/#post-5267113)
 * Problem is fixed. There must have been some random characters in the code. When
   I retyped everything from scratch using a text editor, it worked.

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

The topic ‘Parse error in shortcode inserted into page’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [dpurselle](https://wordpress.org/support/users/dpurselle/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/parse-error-in-shortcode-inserted-into-page/#post-5267113)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
