wp override home url with php

Step 1: In your theme's functions.php file, add the following code:

function override_home_url( $url ) {
  if ( is_front_page() ) {
    $url = 'YOUR_CUSTOM_URL_HERE'; // Replace with your custom URL
  }
  return $url;
}
add_filter( 'home_url', 'override_home_url' );

Step 2: Replace 'YOUR_CUSTOM_URL_HERE' with the custom URL you want to use, and save the changes to the functions.php file.

Step 3: Refresh the permalinks by going to Settings > Permalinks in your WordPress admin dashboard and clicking 'Save Changes' to ensure the new home URL is reflected.

Step 4: After following these steps, the home URL on your WordPress site will be overridden with the custom URL you specified.