When you are working with an older site it may be necessary to prevent notice level errors from appearing in the error log so that you aren’t swamped with too many messages.
Adding code to wp-config.php doesn’t work because WordPress itself tries to set the error level.
Instead create a ‘must use’ plugin and add the following:
error_reporting(E_ALL & ~E_NOTICE);
CodeIgniter 4 Access denied message and a 403 response code in browser when hosting with Apache in Laravel Homestead.
It works fine with php spark server but when hosting with Apache the problem happens.
Continue reading “CodeIgniter 4 Apache Access Denied”
It can be useful to use the request object in a view to retrieve input, this was easy with CodeIgniter 3 but with CodeIgniter 4 the documentation doesn’t cover this.
Add this to the top of your view
$request = \Config\Services::request();
Then you can use the request methods like this
<input type="hidden" id="score" name="score" value="<?=$request->getVar('score')?>">
To prevent the debug toolbar from appearing for a certain controller method when in development mode, for example if you are generating a CSV file with code, edit
app/Config/Filters.php and add the following
public function __construct()
// hide debug toolbar when generating a CSV file
if (strpos($_SERVER['REQUEST_URI'], 'export_csv')) unset($this->globals['after']);
It isn’t obvious from the CodeIgniter 4 documentation how to prevent the debug toolbar from being added to the bottom of text output with a ResourceController.
Either output an array which changes the content type to application/json,
public $globals = [
'before' => [
'after' => [
'toolbar' => ['except' => 'feedback/*'],
Or use header
X-Requested-With set to
XMLHttpRequest in a REST client like Postman.
wp_register_script( 'dummy-handle', '' );
wp_enqueue_script( 'dummy-handle' );
wp_add_inline_script( 'dummy-handle', 'var my_variable = true;', 'before' );