If you want the core php query to execute use the below extension.
The Exec-PHP plugin executes PHP code in posts, pages and text widgets.
https://downloads.wordpress.org/plugin/exec-php.4.9.zip
The Exec-PHP plugin executes PHP code in posts, pages and text widgets.
https://downloads.wordpress.org/plugin/exec-php.4.9.zip