0

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';
    ?>
3
  • 1
    where is the code ? and you can't write PHP code in WordPress pages, and its not recommended to do so. Commented Dec 28, 2015 at 6:54
  • so how can write PHP script.??? Commented Dec 28, 2015 at 7:00
  • Possible duplicate: stackoverflow.com/questions/18896146/… Commented Dec 28, 2015 at 7:33

2 Answers 2

1

When inserting your PHP code into wordpress pages, there are two recommended ways:

  • make a child theme
  • write your own plugin

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

Sign up to request clarification or add additional context in comments.

Comments

0

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.

https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/#creating-custom-page-templates-for-global-use

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.