Support » Plugin: Make Paths Relative » Add for esc_url()

  • Resolved Grafffs

    (@grafffs)


    Please add functional in your plugin for “esc_url()” function:

    public function clean_url( $good_protocol_url, $original_url, $_context ) {
        return str_replace(array('http://' . $_SERVER['HTTP_HOST'], 'https://' . $_SERVER['HTTP_HOST']), '', $good_protocol_url);
      }
    add_filter( 'clean_url', array( $this, 'clean_url' ), 100, 3 );
    • This topic was modified 10 months, 2 weeks ago by .
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi @grafffs Can you please add some description what do you mean by adding this function? I mean the use-case why it is needed and when so I can add it.

    Thanks,
    Sami

    Thread Starter Grafffs

    (@grafffs)

    Your plugin does not work if the URL is processed using the function esc_url()
    For example:
    <img src="<?php echo esc_url($url); ?>">

    inCreativeWeb

    (@jayeshincreativewebcom)

    Hi,

    It very good Plugin 🙂

    But, I face issues in both cases, can you share with me how to fix the URL below both cases?

    <?php echo home_url(‘/’); ?>“>Home

    <img src="<?php echo get_stylesheet_directory_uri(); ? />/assets/img/logo.svg” alt=”InCrativeWeb”>

    Thanks,
    Jayesh Patel

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi @grafffs

    I have added support for esc_url() and released v1.3.0.

    @jayeshincreativewebcom Please update the plugin first and check whether it automatically works for you or not on your above listed cases. If not then wrap your functions with esc_url() like shown below:

    
    <a href="<?php echo esc_url( home_url( '/' ) ); ?>">Home</a>
    <img src="<?php echo esc_url( get_stylesheet_directory_uri() ); ? />/assets/img/logo.svg” alt=”InCrativeWeb”>
    

    Thanks & Regards,
    Sami

    Thanks & Regards,
    Sami

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add for esc_url()’ is closed to new replies.