Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8322519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:25:04+00:00 2026-06-08T23:25:04+00:00

How to remove http:// www. from php array, here is my code that displays

  • 0

How to remove http:// www. from php array,

here is my code that displays a store url and I just want domain.com to be displayed instead of http://www.domain.com, also may show as http://domain.com

code: <p class="store-url"><a href="<?php echo $url_out; ?>" target="_blank"><?php echo $stores_url; ?>

It displays like this because of this function

<div class="store"> 

<?php // grab the store meta data 
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
$stores_url = esc_url(get_metadata(APP_TAX_STORE, $term->term_id, 'clpr_store_url', true));
$dest_url = esc_url(get_metadata(APP_TAX_STORE, $term->term_id, 'clpr_store_aff_url', true));

// if there's a store aff link, then cloak it. else use store url
if ($dest_url)
$url_out = esc_url(home_url(CLPR_STORE_REDIRECT_BASE_URL . $term->slug));
else
$url_out = $stores_url; 

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T23:25:07+00:00Added an answer on June 8, 2026 at 11:25 pm

    Try:

    <?php $stores_url = preg_replace('/^https?:\/\/(?:www\.)?/i', '', $stores_url); ?>
    <p class="store-url"><a href="<?php echo $url_out; ?>" target="_blank">
        <?php echo $stores_url ?>
    </p>
    

    It will remove http:// or https:// from the beginning of the URL as well as www if it follows.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The php code of barcode generator (which take from here http://www.barcodephp.com/en/userguide ) looks like
Lets say my URL is: http://www.example.com/news/media-centre/news/17/an-example-news-post/?foo=bar I want to in PHP remove the last
how to remove degrre symbol form this URL NSString *s= http://www.com/appfeed/default.php?app=1.31223 ° |103.865**°**|56a76d i
This is my code: function get_remote_file_to_cache(){ $sites_array = array(http://www.php.net, http://www.engadget.com, http://www.google.se, http://arstechnica.com, http://wired.com); $the_site=
My domain is http://www.somename.com . I want if an user type {path to website}/index.php,
Ok how do i use regex to remove http AND/OR www just to get
i have this youtube url http://www.youtube.com/watch?v=9N51Etoikfw&feature=youtube_gdata i need to remove the feature parameter and
File: /home/USER/DIR/a http://www.here.is.a.hyper.link.net/ /home/USER/DIR/b http://www.here.is.another.hyper.link.net/ Need to remove all the odd lines in this
I want to do a simple re write from http://www.example.com/iran/iran/province/Yazd to http://www.example.com/iran/province/Yazd This is
I need a php function which produce a pure domain name from URL. So

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.