Please help newbie author for 1 WP soft rejection


i am getting this soft rejection few times so would be grateful if you can help me to get over to this

_ph_p session_start();header('Content-type: text/css; charset=utf-8');$parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );require_once( $parse_uri[0] . 'wp-config.php' );?> <?php$categories = get_c


And this should be? can you paste a complete code ex. codepen or pastebin


here is complete code


What does your soft reject say though? Did the reviewer paste that code into the rejection email? Did they say specifically what was wrong with it?

this is what they wrote

The following isn’t safe:

Can you tell me in what context would you be using this? These kind of things are to be avoided in wordpress themes, which is why you’re getting the soft reject. Wordpress themes have a bunch of action, filter and function for this kind of reason, I guess it’s a wordpress policy if you need something, we’ll make a function for it. Reason why I personally don’t like WP, since it’s bloated to the core.
Why don’t you hook it to the wp_head action? You avoid having to manually include wp-config.php, you are sure to have access to get_categories function as well. I don’t see any reason why you would want to use this in a separate file.