WordPress Interview Questions and Answers 2

Q1. How will you disable theme and plugin editing in your WordPress admin?

Ans. Adding the following constant will disable theme and plugin editing from within the WordPress admin:

   define(‘DISALLOW_FILE_EDIT’, true);

Q2. How will you prevent automatic update to a plugin which you have modified?

Ans. You can do it by changing the name of the plugin’s directory then activating it again into your WordPress dashboard. Alternatively, you can modify the name of the plugin to achieve the same.

Continue reading

How to show page load time in PHP ?

If you need to calculate how much time elapsed during this the queries execute on the page.

The answer is:

$start = microtime(true);
$end = microtime(true);
printf("Page was generated in %f seconds", $end - $start);

For reference, microtime() in a PHP predefined function.

Write $start just before your query or the beginning of the page and $end at the end of all the queries or at the end of page.