As I understand PHP and WordPress syntax will throw 404 error if it is within a functions.php file.
Can be managed WordPress hook like an example within hook directory (not a plugin)?
I have added PHP inside a functions file:
Why is now showing a PHP content with an error 404 or it can be solved a hook as PHP?
Have you checked the path specified in
Is this true or do you have an example?
if you’re seeing the PHP content itself along with a 404 error. This suggests that WordPress isn’t processing the PHP file but is trying to serve it as plain content, and the server isn’t set up to do so for that request.
Create a custom function to alter the behavior of your script.