Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Beginner’s Guide till fil- och directory-struktur i WordPress

Vill du lära dig mer om WordPress filer och directory-struktur?

All core WordPress-filer, themes, tillägg och uppladdningar från användare lagras på servern på webbhotellet för din website.

I denna guide för nybörjare förklarar vi fil- och directory-strukturen i WordPress.

WordPress file and directory structure explained for beginners

Varför bör du lära dig mer om fil- och directory-strukturen i WordPress?

De flesta användare kan run sin WordPress website utan att någonsin lära sig om WordPress filer eller directories. Men genom att förstå hur WordPress lagrar filer och directories kan du lösa många vanliga WordPress-problem på egen hand.

Den här guiden hjälper dig:

  • Lär dig vilka WordPress-filer och -folders som är core-filer.
  • Förstå hur WordPress lagrar dina images och mediauppladdare.
  • Var WordPress lagrar dina themes och tillägg.
  • Var konfigurationsfiler lagras på din WordPress install.

Denna information hjälper dig också att lära dig hur WordPress fungerar bakom kulisserna och vilka WordPress filer du bör göra backup på.

Med detta sagt, låt oss ta en titt på fil- och directory-strukturen i WordPress.

Åtkomst till filer och directories i WordPress

Dina WordPress-filer och -directories lagras på din web server. Du kan komma åt dessa filer genom att använda en FTP-klient. Se vår guide om hur du använder FTP för att uppladare WordPress-filer för detaljerade instruktioner.

Ett enklare alternativ till FTP är appen File Manager som är inbyggd i kontrollpanelen för de flesta webbhotell i WordPress.

File manager app in hosting control panel

När du har anslutit till din WordPress site antingen med FTP eller File Manager, kommer du att se en fil- och directory-struktur som gillar detta:

WordPress files and folders

I rotmappen hittar du WordPress core-filer och -mappar. Det är dessa filer och foldrar som driver din WordPress site.

Förutom .htaccess- och wp-config.php-filerna är det inte meningen att du ska editera andra filer på egen hand.

Här är en lista över WordPress core-filer och -folders som du kan se i din WordPress sites root directory.

  • wp-admin [dir]
  • wp-content [dir]
  • wp-inkluderingar [dir]
  • index.php
  • licens.txt
  • readme.html
  • wp-activate.php
  • wp-blogg-header.php
  • wp-comments-post.php
  • wp-config-sample.php
  • wp-cron.php
  • wp-links-opml.php
  • wp-load.php
  • wp-login.php
  • wp-mail.php
  • wp-settings.php
  • wp-signup.php
  • wp-trackback.php
  • xmlrpc.php

I listan ovan saknas filerna .htaccess och wp-config.php. Det beror på att dessa två filer skapas efter att WordPress installerats.

WordPress Konfigurera filer

Din WordPress root directory innehåller några speciella konfigurationsfiler. Dessa filer innehåller viktiga Settings som är specifika för din WordPress site.

WordPress configuration files
  • .htaccess – En konfigurationsfil för servern, WordPress använder den för att hantera permalänkar och redirects.
  • wp-config.php – Den här filen talar om för WordPress hur man ansluter till din database. Den anger också vissa globala Settings för din site i WordPress.
  • index.php – Indexfilen hämtar och initierar alla dina WordPress-filer när en användare requestar en page.

Ibland kan du behöva editera wp-config.php eller .htaccess-filen. Var extra försiktig när du editerar dessa två filer. Ett litet misstag kan göra din site otillgänglig. När du editerar dessa två filer ska du alltid skapa backup-kopior på din dator innan du gör några ändringar.

Om du inte ser .htaccess-filen i din root directory, kolla in vår guide om varför du inte kan hitta .htaccess-filen i din WordPress root directory.

Beroende på hur din WordPress site är konfigurerad kan du ha eller ej ha följande filer i din root directory.

  • Robots.txt – innehåller instruktioner för sökmotorers crawlers
  • Favicon.ico – En favicon-fil genereras ibland av WordPress-webbhotell.

Inuti wp-content foldern

WordPress lagrar all uploads, plugins och themes i mappen wp-content.

WordPress content folder

Det antas allmänt att du kan editera filer och foldrar i mappen wp-content. Detta är dock inte helt sant.

Låt oss ta en titt i wp-content foldern för att förstå hur den fungerar och vad du kan göra här.

Inside wp-content folder

Innehållet i mappen wp-content folder kan skilja sig åt från en WordPress site till en annan. Men all WordPress webbplatser har vanligtvis dessa:

  • [dir] themes
  • [dir] tillägg
  • [dir] uppladdare
  • index.php

WordPress lagrar dina theme-filer i /wp-content/themes/ folder. Du kan editera en theme-fil, men det rekommenderas allmänt ej. Så snart du uppdaterar ditt theme till en nyare version kommer dina ändringar att skrivas över under updatingen.

Det är därför vi rekommenderar att du skapar ett barntema för WordPress customize av teman.

Alla WordPress tillägg som du downloadar och installerar på din site lagras i /wp-content/plugins/ folder. Det är inte meningen att du ska edit filer för plugin direkt, såvida du inte skrev site-specifika WordPress plugin för din egen användning.

I många WordPress tutorials kommer du att se code snippets som du kan add till din WordPress site. Du kan lägga till customizer-kod på din WordPress-webbplats genom att lägga till den i functions.php-filen i ditt barntema eller genom att skapa ett site-specifikt plugin.

Men det enklaste och säkraste sättet att add to custom code är genom att använda ett code snippets plugin som WPCode. För steg-för-steg-instruktioner, se den här guiden om hur du enkelt lägger till custom code i WordPress.

WordPress lagrar all din image och mediauppladdningar i mappen /wp-content/uploads/. Som standard är uppladdare organiserade i /year/month/ folders. När du skapar en backup av WordPress bör du alltid inkludera mappen uploads.

You can download fresh copies of WordPress core, your theme, and installed plugins from their sources. Men om du förlorar din uploads folder, då skulle det vara mycket svårt att återställa den utan en backup.

Några andra standardmappar som du kanske ser i din wp-content directory.

Många tillägg till WordPress kan också skapa egna foldrar i din wp-content folder för att lagra filer.

Vissa tillägg till WordPress kan skapa mappar i mappen /wp-content/uploads/ för att save uppladdningar från användare. I instance, this demo website has folders created by Smash Balloon, WooCommerce, SeedProd, and WPForms plugins.

Plugins may create their own folders inside uploads directory

Vissa av dessa foldrar kan innehålla viktiga filer. Därför rekommenderar vi att du säkerhetskopierar alla sådana foldrar som en försiktighetsåtgärd.

Andra foldrar kan innehålla filer som du kan ta bort på ett säkert sätt. Till exempel kan dina tillägg för caching, som gillar WPRocket, skapa foldrar för att save caching data.

Det var all, vi hoppas att den här artikeln hjälpte dig att förstå fil- och directory-strukturen i WordPress. Du kanske också vill se vår Beginner’s guide till hantering av WordPress database med phpMyAdmin, och vår tutorial om hur man skapar ett custom WordPress theme utan någon kodningskunskap.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

57 kommentarerLämna ett svar

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Moinuddin Waheed says

    I have always fantasized about what goes behind the scene to run such a good wordpres front end and backend interface.
    This guide has cleared all those behind the scene aspect of wordpress working.
    Having a knowledge of these files and directories structure gives us command over tweaks that we can make.
    Thanks wpbeginner for this guide on wordpress file structure.

    • WPBeginner Support says

      It is almost the same, a multisite install would have folders for each of the subsites.

      Administratör

  3. Fawwad says

    Thanks for sharing this information. This will help a lot during troubleshooting and website backup n restore.

  4. Amit Maheshwari says

    Please help me on how can I create a folder inside my blog hoste on wordpress on my site. I want to create more subfolder under that like news, life etc to make sure my users get the content more organized?

  5. Kosovi says

    Getting this error: Fatal error: Call to undefined function wp() in XXXX\html\wp-blog-header.php on line 12. Tried several troubleshooting, but wont solve the issue. Stoped Theme, and pluggins.

  6. Bruno rasmussen says

    Hi
    Im getting the error message about a missing ads.txt file, i know where to find it, but im not sure where i have to insert it.

    Best regards
    Bruno
    Denmark

  7. J.Hameed says

    Am trying to upload an unzipped file to this location:

    wp-content/uploads/GeoLite2-Country.mmdb

    Question : How do I find the location and how do i upload the unzipped file to this location.

    • WPBeginner Support says

      The closest to what it sounds like you’re wanting is under wp-content>Uploads

      Administratör

  8. John says

    Hi
    My website was hacked. it keeps redirecting me to a spammy site. I can’t log in via the backend (cos it keeps redirecting me to a spammy site) and I don’t have a backup of the site but I can still access my Cpanel but dont know what to do there, please any help will be appreciated.
    hemjaypost.com is the site

  9. Karen says

    Crazy question.
    After importing demo site content on an Avada themed site – there are so many pages I have NO IDEA how to get back to identify and edit my home page in the PAGES link? I now have 8 pages of ”pages”. How can I find my Home page? BTW – In READINGS > SETTINGS – I’ve checked blog assigned to home page NOT to a STATIC Page. Many thanks!
    I have googled several ways – but can’t figure out this thing!

    • WPBeginner Support says

      Hi Karen,

      When you go to Pages » All Pages you should be able to see — Homepage label next to the page used as your homepage. You can also try reaching out to the theme developer for support.

      Administratör

  10. Mary Emerson says

    I, too, want to find where my old .htm files that are now encased in WordPress with different urls! I need to delete a bad xml file and I have to idea how to go to server and remove. I removed it permanently inside the page list, but I am afraid Bing is still thinking that is what I want submitted. It keeps saying it is not valid and I want to clear it out!
    Thank you!

  11. Lalit Kumar Yadav says

    hi
    i developed an custom post in woocommerce website. But after that i want to use an dynamic photo slider in this custom post, i tried a lot but failed to make it dynamic.please guide me about the use of page template and how to make slider dynamic.

  12. Ajju says

    Helpfull but i want edit a page outside without WordPress , by another html editer ,becouse i try to remove theme on some specific pages ,but not entier website

  13. JohnLeyo says

    thank you, that was very helpful… but i want to know if it is safe to replace all the wordpress core files by a new files?

  14. Ben says

    Hi there, I recently downloaded my old WordPress site onto my computer, and installed a new site on my domain. I am now trying to dig around and find all my blog posts from the old site so I can add them to the new site, any idea if thats possible and where I would find those? Thanks so much for your help.

  15. Hany Danial says

    what is the file name for the users in the wordpress? I have a complete backup for my site, moved it to another server, the number of the users were about 24K but now I found only 9K and I would like to restore the old one. Thanks in advance for your reply. Hany Danial

  16. Amit says

    Hi,

    Suppose if I want to change the look of the WordPress theme then which files are important or in which file do I need to change the code?

    Since last 2 years I am thinking to change the some little look of my theme but because of not fully understanding I couldn’t do it.

    Thanks,
    Amit

  17. tushar says

    Hi, thank you for this post I agree with you that An easier alternative to FTP is File Manager. It is a web-based application that comes built into cPanel dashboard of your WordPress hosting account. very useful information

  18. john says

    how to i change upload the pictures for the web site or upload the new coupon for the website that use WordPress or edit the content of the website?

    when I login to the FTP site, i see these 3 folders
    wp-admin
    wp-content
    wp-includes

    thanks
    john

      • john says

        thanks. the company who wrote the website did not transition to me. How do I request to reset the password to login to the admin page?

        also, i need to update just the coupons by update the new images of the coupons.

        also, how to i transfer the page_id=369 to the coupons page

        thanks again,
        John

  19. Ezeudo Emmanuel says

    great article. But I have a question though. I am a beginner and trying to design a website via wordpress. i have finished the design to an extent. but my problem is that when i try to upload my wordpress file via ftp (file zilla), i cant seem to find the file on my C:/. how to i locate my wordpress file? thank you as i await your response

  20. KAIZER MD AMIN says

    It is really helpful for me as I am just starting out with my blog and I have very little knowledge about these technical issues. Great content, thanks.

  21. fassaha says

    Great article! I do have a question though: Where do we actually find the articles that we wrote on the site? Let say I write an article on my site. This article is normally stored in wordpress files. where can I find it?
    Thanks

    • Henric Åkesson says

      Your article itself will not be stored in files, it will be stored in the database. Only your files will be stored inside the wp-content/uploads.

      Ok? :)

  22. ademola says

    please i need your help urgently, i want to restart my afresh. But i just need my articles and its images. i do not need anything else.The reason for this is that my hosting is saying someone is using my site to spam people using a business address i did not even add to my webmail. if i delete it they create another one. but now another issue is thta malware are been detected on the site. but i am using the newspaper theme so i do not know why all this issues. I can do all the installing of new wordpress and every other thing but i need to just put the contents i have on the new site i am going to create. i still have my old site on now and i have the backup in my file manager home directory.

  23. mimo says

    Thanks for the article….what about finding ”pages” on the directory? i cant seem to find them…will they be accessible via cpanel or just in the wp interface? i see all the image files i uploaded on the [dir]uploads page, organized by month/year as you mentioned on the cpanel directory, but was wondering where i can find the actual Pages file/word content pages? thank you…

      • Buck Riley says

        So, there’s no way to get the contents of the page themselves through the FTP? Like, if I wanted to pull my about page from the FTP, I wouldn’t be able to do that?

        • Buck Riley says

          Or… is this databased stored elsewhere on the site outside of the wordpress folder, and having only backed up the wordpress folder when my site was deleted, I’ve lost all of my content?

        • WPBeginner Support says

          No, you will not be able to do that.

          WordPress does not create and store static pages. Instead, it stores your content in a database and then generates HTML pages on the fly.

        • Robert says

          ”No, you will not be able to do that.

          WordPress does not create and store static pages. Instead,
          it stores your content in a database and then generates
          HTML pages on the fly.”

          After a WSOD and several hours of trying to get back to the dashboard, I deleted all WP files from my file mgr. Before I did that I backed up and stored all of those files in a temp file in file manager.

          Is there a way I can get my input (static pages) generated in html, so I may copy them?

          I am about ready to install another WP theme, but before I do so I hold a slim hope that these pages are still stored somewhere, like in an etheral world of some database.

        • Josh says

          Robert, I second your motion. The answer has been rather expertly skirted around here. Is there some kind of membership fee we need to pay for these kind of seemingly simple answers? All I can find is the import/export tool for the pages, then edit the CSS or delete the unnecessary pages as desired.

  24. Hemang Rindani says

    Nice article. For development team working with enterprise content management services like WordPress (or in that matter any other CMS like Sitefinity, Drupal, etc.) must understand the basic file structure. This will not only help them find the files but with this they will also be able to organize the files in proper way.
    Using a nested approach to save your content and system files is a the best way to design a file structure.

  25. Rafique says

    Thank You so much. It was Really Helpful for me. I work in my University Webteam and have made a website for them :)

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.