[Support request] Relative or full path URLs?

Home Forums Support Relative or full path URLs?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1103122
    Rui

    Hello!

    Inside a code snippet or a hook, what is the best practice: use relative or full path URLs?

    When calling an image, for example, it would be better to use:

    img src=”./wp-content/uploads/fig.jpg”

    img src=”https://mydomain.com/wp-content/uploads/fig.jpg”

    or even ‘img src=’ . $_SERVER['DOCUMENT_ROOT'] . ‘/wp-content/uploads/fig.jpg’ ?

    #1103433
    Leo
    Staff
    Customer Support

    Hi there,

    I always just use the full URL as it always works.

    Not sure if there is a best practice though as long as they work.

    The theme itself doesn’t control this at all.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.