• 0

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 190


File: /var/www/html/thecodehelp.com/application/views/question.php
Line: 190
Function: _error_handler

File: /var/www/html/thecodehelp.com/application/controllers/Questions.php
Line: 416
Function: view

File: /var/www/html/thecodehelp.com/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Wordpress add action 'init' not working frontend

I have installed Wordpress without making any changes and using the standard 2019 theme. I want to create virtual pages when ever specific url patterns are called. To do this I need to run a URL rewrite as early as possible, so I have added this line to the top of the themes functions.php file:

function url_rewrite() {
add_action('init', 'url_rewrite');

I get the message 'here' as expected on pages, but if its a URL which does not exist the site is not picking this up at all, it just goes to a 404 page. I'm hoping someone knows why.

I have also tried:

add_action('init', 'url_rewrite', 1, 0);