GithubHelp home page GithubHelp logo

Comments (11)

justintadlock avatar justintadlock commented on July 20, 2024 2

I'd just include the most obvious problems in an error, which are probably jquery (and maybe masonry). I don't think I've seen a theme attempt to deregister anything else.

The entire reason behind this came about because we had themes trying to deregister the core jQuery and register their own. So, the core of the problem is this:

wp_deregister_script( 'jquery'

wp_register_script( 'jquery'

Catch those two things and you've caught 99% of the problem.

from wpthemereview.

grappler avatar grappler commented on July 20, 2024 1

@WPTRT/core Can you think of any reason why a them should be able able to deregister a script? I can' think of any. If we can't think of any we could change the sniff from a WARNING to an ERROR.

from wpthemereview.

Pross avatar Pross commented on July 20, 2024

See #26

from wpthemereview.

justintadlock avatar justintadlock commented on July 20, 2024

There's definitely at least one reason. For example, a theme might want to run a custom media player on the front end. It could deregister or dequeue the core scripts and roll its own. I do this with styles and don't think it's a stretch to think that a theme could do it with the media player scripts.

That's all I got at the moment.

from wpthemereview.

Pross avatar Pross commented on July 20, 2024

So is the answer to check for deregistering certain scripts?

from wpthemereview.

justintadlock avatar justintadlock commented on July 20, 2024

Definitely. We can stop themes from deregistering core WP scripts (can always dequeue in my example above). Themes must have the ability to deregister parent theme and/or plugin scripts.

from wpthemereview.

Pross avatar Pross commented on July 20, 2024

Should we include ALL scripts from https://developer.wordpress.org/reference/functions/wp_enqueue_script/#defaults or should a list be drawn up?

from wpthemereview.

Pross avatar Pross commented on July 20, 2024

Updated PR does exactly this ^

from wpthemereview.

jrfnl avatar jrfnl commented on July 20, 2024

From: #26 (comment)

Just a thought: what about keeping this list in line with the scripts WP core protects itself against from being deregistered on the admin side ?
The list can be found in the code of this function: https://developer.wordpress.org/reference/functions/wp_deregister_script/

The current PR #26 checks against jquery and is about ready for merge consideration.

Is there a decision that that's enough or are what we have currently opinions and does this still have to go to the Theme Review Board for definite approval ?

/cc @grappler

from wpthemereview.

justintadlock avatar justintadlock commented on July 20, 2024

I think we're probably OK with this. If we need to add more, the code already looks like it's set up for just plugging in new script handles.

from wpthemereview.

dingo-d avatar dingo-d commented on July 20, 2024

The sniff for this exists: NoDeregisterCoreScript. If this is correct @jrfnl can you close this issue?

from wpthemereview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.