Hi there -
I’m sorry in advance if this is the wrong place to post. I am learning wordpress and making my first from scratch wordpress template. I am getting the error below when I launch my site on local:
Warning : Array to string conversion inC:\Users\Melis\Local Sites\boat\app\public\wp-includes\http.php on line695
Line 695 of http.php is:
$url = (string) $url;
In my functions file I am just looking to do a conditional based off of the current page slug. The page slug is showing on the webpage when I print_r it, but it won’t let me access the admin side of the site and gives me the error code above about converting an array to a string. Do I need to make this into an array and loop over…? Thank you for any guidance, I’ve been trying to troubleshoot this for a while now and am feeling pretty defeated.
Functions file:
function add_checkPage() {
global $page_template_slug;
print_r($page_template_slug);
if ( $page_template_slug === 'findYourTrip.php' ) {
wp_register_script('js-script', require_once( __DIR__ . '/includes/findYourTripFunctions.php'), array ( 'jquery' ), 1.1, true);
wp_enqueue_script( 'js-script');
}
Header file:
global $page_template_slug;
$page_template_slug = esc_html(get_page_template_slug($post->ID));
Here’s my error logs if these are helpful:
error.log (9.6 KB)
local-lightning-verbose0.log (802.4 KB)