WordPress.org

Ready to get started?Download WordPress

Forums

Better to edit php files in FTP or WordPress? (20 posts)

  1. Just Football
    Member
    Posted 4 years ago #

    Hi,

    Just a quick general question, for which I can't find the answer in a forum search.

    When editing the template of your WordPress theme, is it better to do in WordPress editor itself or through the FTP client?

    I need to edit an archive.php file but am not sure which is the best way to do it, or if the changes will filter through to either one. (ie if I edit through WordPress will it automatically edit the FTP file).

    Thanks in advance

  2. Bramernic
    Member
    Posted 4 years ago #

    Just to clarify, are you talking about versions on your own computer and your hosting? If you are then using the WP editor will amend the one on your hosting. If you need a copy on your computer you'll need to ftp it back again.

  3. Just Football
    Member
    Posted 4 years ago #

    Okay so am I right in saying there are 3 elements here: FTP, WordPress editor and the hosting account (CPanel or whatever)?

    Editing the theme through the WordPress editor (via dashboard) edits the hosting (CPanel) files? But not the FTP files?

    Whereas editing the file via FTP Client edits all three?

    If so that would mean its better to edit files through the FTP Client...

    Am I right?

  4. Bramernic
    Member
    Posted 4 years ago #

    Ah, you're using a WP installation through your hosting. I apologise but I've not used that route before. It is possible that using FTP to edit a file from CPanel may be the same as using the WP editor. When you save using the FTP client does it copy it back automatically? If yes then there is no difference in the end result.

  5. @mercime
    Volunteer Moderator
    Posted 4 years ago #

    Just to clarify - you can edit template files which are in webhost's server via cpanel and WordPress editor. However, you don't have a copy/backup of your edits in your computer hard drive because all changes were made online.

    When you edit your template files in your computer's hard drive with a text editor and save it, you can upload the revised template file via FTP or cpanel upload. In this scenario, you have the revised template file in your hard drive and webhost server.

  6. Just Football
    Member
    Posted 4 years ago #

    Ok thanks, so best way therefore is to download file to FTP Client, edit and re-upload?

    Doesn't that mean you lose any backup, because you have edited it completely? I'm new to WP, and the relationship between FTP, the WP editor and the hosting account, and where backups are stored and kept is confusing me!

  7. kmessinger
    Volunteer Moderator
    Posted 4 years ago #

    FTP is file transfer protocol. It moves files from and to the server and from and to your computer. It has nothing to do with editing files.

    If you edit a file with WP editor, you need to FTP that file back to your computer if you want a backup. If you edit a file on your computer you need to FTP it to the server for any changes to take place.

  8. Saildude
    Member
    Posted 4 years ago #

    Make a backup copy of the file you are going to edit - I make a folder called "Archive" to store backups and past changes much of the time, the Archive folder is below the folder that the file I am editing is in. I do the editing with Notepad++ mostly and then ftp the file back to my site.

  9. Just Football
    Member
    Posted 4 years ago #

    Thanks guys.

    @Saildude - an Archive folder in the local site or remote site?

  10. Saildude
    Member
    Posted 4 years ago #

    Archive folder is usually on my desk PC - you could also make an archive folder on your remote site if you wanted. Sometimes I will rename the old file on my site just before I ftp a new file up - that is probably not a good idea on a high traffic site. The important thing is to have a backup file in case any changes turn out real bad - then just put the old file back and not need to worry about backing out changes.

  11. Just Football
    Member
    Posted 4 years ago #

    I guess if you downloaded a theme you can use the original theme files as backup...

  12. Saildude
    Member
    Posted 4 years ago #

    Correct the original Theme Download can be your backup - I did that with my Theme. I modified 2 Theme files and they are in a Folder called Web Changes.

  13. Kim09
    Member
    Posted 4 years ago #

    I usually also edit in cpanel, or in WordPress site admin if it has to do with the template: Admin < Appearance < Editor, depends on how big the file, if it's too big, then in cpanel is better in my opinion. But don't forget to make yourself backup or your files in case you made something wrong. Good luck :)

  14. Just Football
    Member
    Posted 4 years ago #

    Hi guys, thanks :-)

    1, Kim - how do you edit in cpanel? Does editing in cpanel automaticall filter to the FTP client? Or the WP editor? Or neither?!

    2, Also have one other FTP related question - how do you upload images to posts without the FTP Client? I'm just thinking, if someone other than me (i.e. without access to the FTP client, writes an article and wants to upload an image, where would he/she upload it?)

    Still pretty confused about the relationship between the 3 (FTP, WP, host) as you can tell!

  15. MichaelH
    Member
    Posted 4 years ago #

    Let's assume you want to edit a theme file--you could edit a specific file in three ways:
    1. In Administration > Appearance > Editor
    2. Via FTP Client such as FileZilla
    3. Via cPanel File Manager, Edit option.
    Each method is a bit different and really not related, but the end result is same.

    As for your image upload question you can upload an image when writing or editing a post and you don't need FTP to do that.

  16. Just Football
    Member
    Posted 4 years ago #

    Hi Michael, thanks.

    So how does one keep everything in order? I mean, each post you write you could edit in a different way and then one day if something goes wrong you have no idea where everything is, right? Is there a sort of 'standard' or 'best' way of going about it?

    Re: images, I guess I'm getting at the same question - how do you go about making sure images are all in one place (including those uploaded by other posters on other computers) so that if you lose everything you can still access them?

  17. lookbelow
    Member
    Posted 4 years ago #

    it does the same thing although i much prefer ftp even though the wordpress way is quicker

    and yes it will change the ftp version of it if you edit it in woordpress [it's the same file].

  18. MichaelH
    Member
    Posted 4 years ago #

    I mean, each post you write you could edit in a different way

    No, you write/edit posts via the add/edit posts screen. Don't confuse that with FTP.

    You might want to install WordPress and write a few posts to see how it works.

    Re: images, I guess I'm getting at the same question - how do you go about making sure images are all in one place (including those uploaded by other posters on other computers) so that if you lose everything you can still access them?

    Images that get uploaded as part of writing posts get put into the folder you set via Administration > Settings > Miscellaneous.

  19. vtxyzzy
    Member
    Posted 4 years ago #

    If I might make a suggestion: it is a little extra work, but I recommend setting up a 'local install' of your WordPress site on your own PC. You can edit and test changes on your PC, and then when things are working, use FTP to copy them to the live site.

    First, working on your own PC will save you lots of grief when testing changes. You don't take the chance of messing up the live site so badly that you can't even log on to fix things.

    Second, I find the editors availble on the local PC to be much easier to use than the WP editor. Lots of good choices here. For example, give Notepad++ a try.

    Third, local files may be a little easier to back up. You can just copy and paste them to a backup folder (although FTP is almost that easy).

    Fourth, response time is not an issue. A slow connection will not hinder your work.

    Just my two cents.

  20. codelobster
    Member
    Posted 3 years ago #

    I use free PHP editor with FTP Codelobster PHP Edition.
    It has also special plug-in for WordPress including Theme Editor.

Topic Closed

This topic has been closed to new replies.

About this Topic