Array to String Conversion in app\public\wp-includes\http.php on line 695

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)

Does this potentially have to do with parsing the url with a component back into a string in the http.php file?
https://www.php.net/manual/en/function.parse-url.php

Continuing to troubleshoot…

Hi @MMision

Admittedly this doesn’t seem related to Local specifically but more of a common WordPress error. I’m seeing it pop up on a lot of threads here that might be more helpful in troubleshooting development-related issues:

Google Search Results

This video might be a good place to start!

1 Like

Hi @Nick-B sorry for the late reply but I’m just realizing that I didn’t post a response. What you sent over was very helpful - thank you (again) for your help!

2 Likes

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.

Glad to hear it @MMision! Thank you for letting us know :green_heart:

1 Like