Support » Fixing WordPress » OK to delete unused theme files?

  • Resolved jamie k

    (@otto0731)


    Firstly, I’m not a developer, but comfortable with HTML/CSS. My question is whether it’s okay to delete seemingly redundant PHP files from my
    theme. Those are archive.php, attachment.php, author.php, links.php and taxonomy.php.

    Is there any adverse impact by deleting these files? I’ve spent hours removing any redundant codes from theme files, and am now thinking about deleting all files that don’t seem to be used.

    Thanks for your advice in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator stephencottontail

    (@stephencottontail)

    What theme are you using, and why do you think those files you listed are redundant? Some of the files you listed are part of WordPress’ template hierarchy, and while WordPress will provide appropriate fallbacks if those files are not present in your theme, there may be some unexpected behavior if those files are removed.

    Also, be aware that if your theme is ever updated, to fix security issues or bugs or to introduce new functionality, those files will return.

    Thanks for the feedback! I use Commune theme, but have customized to the extent that no one can tell what theme I’m using. I’m a bit perfectionist, and wanted to remove all the redundant codes in the theme, redundant theme files (for example, I know author.php won’t be needed as I don’t archive posts by authors). Also, I’ve never updated the theme cos I know I’ll lose all the changes I’ve made.

    Is it safe to remove all these files I list? I’m not very sure about taxonomy.php, though (not quite sure what this file is for).

    Thanks in advance.

    Moderator stephencottontail

    (@stephencottontail)

    Well, I installed the Commune theme on my local WP install and deleted those files you listed and I saw no adverse effects by doing so. Although that isn’t exactly the most rigorous test, I think you’d probably be okay.

    I still don’t recommend nor understand this course of action. Not upgrading can be a significant security risk. Are you at least keeping WordPress itself up to date?

    Thank you for kindly testing! I’ll try going ahead with the deletion. Yes, I always update to the latest WP version upon release. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘OK to delete unused theme files?’ is closed to new replies.