I want to know Visitor country using PHP and display it in to a WordPress Page.But when I add PHP code in WordPress page or Post it give me error. How can we add PHP code in
When I was trying to accomplish something very similar, I ended up doing something along these lines:
wp-content/themes/resources/functions.php
add_action('init', 'my_php_function');
function my_php_function() {
if (stripos($_SERVER['REQUEST_URI'], 'page-with-custom-php') !== false) {
// add desired php code here
}
}