Title: [Plugin: Widget Logic] Can&#8217;t have &#8216;return&#8217; in function name
Last modified: August 19, 2016

---

# [Plugin: Widget Logic] Can’t have ‘return’ in function name

 *  [Dougal Campbell](https://wordpress.org/support/users/dougal/)
 * (@dougal)
 * [16 years ago](https://wordpress.org/support/topic/plugin-widget-logic-cant-have-return-in-function-name/)
 * I was trying to use Widget Logic with a custom function of my own, and ran into
   a problem. I made a function called `is_return_visitor()` to tell me if the current
   visitor was either a logged-in user or someone who had previously left a comment
   on my site.
 * Widget Logic threw a parse error.
 * The reason is because of the way it handles the option to say `return(foo)`. 
   If you see the string ‘return’ anywhere in the Widget Logic condition, you try
   to parse the code directly, instead of wrapping it in your own ‘return’ statement.
   So, because my function was named ‘is_return_visitor’, Widget Logic thought I
   was using my own return statement.
 * You might consider changing the simple string comparison to a regex, to more 
   accurately detect that.
 * In the meantime, I just renamed my function to `is_repeat_visitor()`.
 * [http://wordpress.org/extend/plugins/widget-logic/](http://wordpress.org/extend/plugins/widget-logic/)

Viewing 1 replies (of 1 total)

 *  [alanft](https://wordpress.org/support/users/alanft/)
 * (@alanft)
 * [16 years ago](https://wordpress.org/support/topic/plugin-widget-logic-cant-have-return-in-function-name/#post-1508094)
 * Sorry about that – I’ll try to find some foolproof way to check if the WL contains
   a proper return.
 * the work around is that IF you have the string ‘return’ in your WL anywhere (
   as you do in the name of a function) that you have to then add an ACTUAL return
   and final semi-colon
 * eg `return is_return_visitor(foo);`

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Widget Logic] Can’t have ‘return’ in function name’ is closed
to new replies.

 * 1 reply
 * 2 participants
 * Last reply from: [alanft](https://wordpress.org/support/users/alanft/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/plugin-widget-logic-cant-have-return-in-function-name/#post-1508094)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
