Reputation: 89
I have a working wordpress theme. I don't have any plugins installed in my theme. When I created a new page and wrote PHP code to echo a single line, it does not show anything. I edit the wp_config
file and set define('WP_DEBUG', false)
to define('WP_DEBUG', true)
......but nothing happen, the code is below
<?php
echo 'gggggggggggggg';
?>
Upvotes: 0
Views: 707
Reputation: 3762
When inserting your PHP code into wordpress pages, there are two recommended ways:
Making a child theme is faily easy and a common way for little PHP extensions.
There is also a plugin available to insert PHP code into pages here.
You should avoid to put PHP files into the internal Wordpress directories or modify wordpress files since these modifications get lost with updates which happen to be quite often in Wordpress
Upvotes: 1
Reputation: 3843
You cannot write PHP in pages directly and its not recommended to do so, because you are opening doors to world of security threats.
The best way to write is, by creating templates(wirte your PHP there) and then assign it to some page.
Upvotes: 0