How can JavaScript code be added before the closing HTML body tag?

With WordPress, JavaScript cannot be output directly to the browser from PHP. You must use WordPress functions like wp_enqueue_script (please read the Notes from the documentation for details) from within an action hook handler for wp_enqueue_scripts. WordPress documentation for wp_enqueue_scripts says: wp_enqueue_scripts is the proper hook to use when enqueuing scripts and styles that are … Read more

Developing an IP lookup function using an API

You’d have to use add_rewrite_rule so you can capture your desired url match and pass it on query_vars Something like; add_action(‘init’, function() { add_rewrite_rule(‘ip/(.+)/?$’,’index.php?ip_search=$matches[1]’,’top’); }); add_filter( ‘query_vars’, function( $vars ) { $vars[] = ‘ip_search’; return $vars; }); dont forget to flush the rewrite rule once you added your own rule, change the permalink settings back … Read more