• Resolved lordram

    (@lordram)


    So I am new to theme development and I was just going over how to link the stylesheets through functions.php file. I came across the wp-enque_style function and one of the variables inside it is $handle. I know this is pretty basic stuff but cannot really pinpoint what exactly the handle is. On the codex, the description for $handle is ‘name used as a handle for the stylesheet’.

    Link to the codex page is https://codex.www.ads-software.com/Function_Reference/wp_enqueue_style.

    I just want to know what the handle generally stands for.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    It’s an arbitrary name that you give

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    It should be unique in case you ever need to dequeue something – to dequeue you target the handle

    Thread Starter lordram

    (@lordram)

    I understand that it should be unique. But what is it used for? Is it a name given to certain functions or variables or something like that?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    It’s there to identify your enqueued script or style should you ever need to dequeue it

    Thread Starter lordram

    (@lordram)

    Correct me if I am wrong : Its like a name given to the script/stylesheet that I just linked to ?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Yes, it’s a way of naming your wp_enqueue_style() stylesheet

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘What is the meaning of handle in WordPress’ is closed to new replies.