Support » Developing with WordPress » Removing excess code

  • I am wanting to start a reasonable discussion on how to remove, and keep removed excess code that I feel is creeping into WordPress. I am not trying to start an argument but to find solutions for the minimalists among us.

    Examples: I created a bare minimum theme but having a css file with zero css commends in it, just the headers. I created an index.php page that calls header, footer and closes the main div. Nothing more. I removed all other themes, turned off pingbacks, notifications, comments etc. I exited the admin system and opened the page.

    There were at least three loaded js files (embed, emoji, comments), and xmlrpc is turned on. There are also css files that are not required.

    I also note that there is default wordpress code that on update loads in themes like 2020, 2019 and 2018 even after they have been removed.

    Are there proper ways to force these to not load and reduce the growing list of inclusions in WordPress? Is there an article or list for minimalising WordPRess for security and performance?
    Cheers

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    All external .js and .css files should be enqueued, so you could dequeue them provided you know the args used to enqueue to start with. Thus you need to add server side code to prevent requesting of unwanted client side files. It’s worth the trade-off IMO.

    You can get a bare bones WP environment started by defining SHORTINIT constant in wp-config.php. But it’s very bare bones, no theming, no users, no a lot of things. I’m unsure of its intended purpose, a kiosk installation maybe.

    There’s little point in trying to reduce the core code base. As you’ve observed, it all comes back after the next update anyway. There’s no mechanism to only apply a partial update. You could create your own fork of WP and assume all maintenance responsibilities. TBH, few would argue that WP is not a beast of a code base. If that’s a serious concern for you, WP is probably not the CMS for you.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.