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

Så här byter/konverterar du custom post types i WordPress

Letar du efter ett sätt att byta eller konvertera custom post types i WordPress?

Ibland kanske du bestämmer dig för att en viss post type inte är lämplig för ditt content. Om du byter till ett annat format kan du skapa en bättre struktur på din website och förbättra din synlighet i sökresultaten.

I den här artikeln visar vi hur du enkelt kan byta custom post types i WordPress utan att använda någon kod.

Converting post types in WordPress

Varför kan du behöva byta post type i WordPress?

Post types är de olika typerna av content som du kan add to your WordPress website. Det finns 5 standard post types:

  • posts
  • pages
  • Attachments
  • Revisioner
  • menus

Du kan också enkelt skapa dina egna custom post types för att bättre organisera innehållet på din blogg. Till exempel kan du skapa custom post types för att displayed portfolios, testimonials, products, and more.

Men ibland kanske du vill byta ut befintligt content till en annan post type. Detta kan vara till hjälp om du gillar att den befintliga post typen inte längre är lämplig.

Om din WordPress blogg till exempel gör filmrecensioner och du precis har skapat en custom post type för den, är det vettigt att byta innehåll från ”Posts” till ”Movie Reviews”.

På samma sätt, om du har något content på dina pages som skulle passa bättre i ett blogginlägg, är det en bra idé att byta post type för bättre synlighet i search.

Genom att göra detta förbättrar du inte ej bara användarupplevelsen på din website utan hjälper även till att organisera content, öka engagemanget hos användarna och förbättra navigationen.

Med detta sagt, låt oss titta på hur du enkelt kan byta eller konvertera WordPress custom post types.

Så här byter du post type i WordPress

Först måste du installera och aktivera pluginet Post Type Switcher. För detaljerade instruktioner, se vår guide för nybörjare om hur man installerar ett plugin för WordPress.

Vid aktivering lägger pluginet till en enkel dropdown-meny till block editor som tillåter dig att byta inläggstyper medan du redigerar ditt content.

Dessutom aktiverar det dig också att konvertera posttyper med hjälp av alternativen Quick Edit och Bulk Actions när du tittar på alla inlägg.

Byta posttyper i Block Editor

Först måste du öppna upp sidan/posten för att ändra post typ i WordPress block editor.

När du är där, förstora tabben ”Summary” från panelen i blocket i det högra hörnet av vyn.

Här kommer du att notera ett nytt alternativ ”Post Type” som läggs till längst ner på tabben. Klicka bara på länken ”Post” bredvid alternativet ”Post Type” för att öppna dropdown-menyn.

Därefter väljer du den custom post type eller standard post type som du vill byta ditt content till.

Change post type in the block editor

Ett bekräftande message visas på din vy.

När du har bekräftat ändringarna kommer post typen omedelbart att ändras i block editor.

Byta post typer med hjälp av alternativet Quick Edit

Du kan också snabbt edit post typer med hjälp av Quick Edit alternativet när du viewar all posts i WordPress dashpanelen.

Först måste du besöka sidan Posts ” All Posts från WordPress admin sidebar.

Alternativt, om du ändrar post typen för en page, så headar du över till Pages ” All Pages vyn från admin sidebar.

När du är där klickar du bara på länken ”Quick Edit” under posten eller sidans titel.

Click the Quick Edit link under the post title

Detta öppnar sektionen ”Quick Edit” för posten, där du kommer att notera en dropdown-meny ”Post Type” längst ner till höger.

Härifrån väljer du helt enkelt den post type som du vill byta till och klickar sedan på knappen ”Update” för att save your changes.

Choose post type from the Quick Edit section

Byta flera posttyper med alternativet Bulk Actions

Du kan också ändra post types för flera posts på en gång med hjälp av inställningen Bulk Actions.

Först måste du besöka sidan Posts ” All Posts från WordPress admin sidebar. Här väljer du alla de posts där du vill ändra post type på din WordPress website.

Efter det väljer du bara alternativet ”Edit” från dropdown-menyn ”Bulk Actions” högst upp. Klicka sedan på knappen ”Tillämpa”.

Choose the Edit option from the Bulk Actions dropdown menu

Nu kommer du att se alla valda poster i läget ”Bulk Edit”.

Härifrån väljer du den posttyp som du vill tillämpa på ditt content från dropdown-menyn ”Post Type” längst ner.

Choose post type option from the bulk edit mode

När du har gjort det, glöm inte att klicka på knappen ”Update” för att lagra dina ändringar.

Bonus: Add Custom Post Types till ditt huvudsakliga RSS-flöde i WordPress

När du har bytt ditt innehåll till den nya custom post typen vill du också locka trafik till den genom att allow användare att upptäcka RSS-flödet för innehållet.

Ett RSS-flöde är ett webbflöde som allow användare att få regelbundna updates och notifications från en website eller blogg som de själva väljer.

När du lägger till den custom post type till ditt huvudsakliga RSS-flöde i WordPress gör du ditt content lätt att upptäcka för användare. Det kommer också att förbättra din sites sökmotorsoptimering och effektivisera processen med att hantera och distribuera ditt content.

Du kan lägga till custom post types till ditt huvudsakliga RSS-flöde genom att add to följande custom code till ditt temas functions.php-fil:

function myfeed_request($qv) {
if (isset($qv['feed']))
$qv['post_type'] = get_post_types();
return $qv;
}
add_filter('request', 'myfeed_request');

Tänk dock på att minsta error när du skriver den här koden kan förstöra din website och göra den otillgänglig.

Det är därför vi rekommenderar att du använder WPCode.

WPCode - Best WordPress Code Snippets Plugin

Det är det bästa WordPress code snippets plugin på marknaden, vilket gör det supersäkert och enkelt att lägga till custom code på din website.

Det levereras också med ett molnbibliotek med code snippets, smart villkorlig logik, kodprioriteringskontroll, säker hantering av error och så mycket mer.

För mer instruktioner, se vår tutorial om hur du lägger till custom post types till ditt huvudsakliga WordPress RSS-flöde.

Vi hoppas att denna tutorial hjälpte dig att lära dig hur du byter eller konverterar custom post types i WordPress. Du kanske också vill se vår Step-by-Step guide om hur du väljer det bästa webbhotellet för WordPress eller våra toppval för de WordPress tillägg som du måste ha för att få din site att växa.

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

45 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. Jiří Vaněk says

    I would like to ask, if this new post type will have its own category on left menu on WordPress administration. That mean on left menu i have pages and posts now. Will I have this new post type as new category on wordpress admin left menu?

    • WPBeginner Support says

      If you are converting to a custom post type then it would depend on the custom post type as categories and tags can be enabled or disabled when creating them.

      Administratör

      • Jiří Vaněk says

        So basically, it is important to choose this option when creating a custom post type. I found it useful to have the articles separated by the left menu at the same time. Thanks

  3. THANKGOD JONATHAN says

    A greate article that explains what I have been finding hard to understand.
    However, I don’t know what is the revision post type is for. Please can you give me some idea about it?
    Thank you for the helpful post

    • WPBeginner Support says

      If your site has a revision post type, that is likely added via your theme or a plugin and it would depend on what added it to determine what it is used for.

      Administratör

  4. Moinuddin Waheed says

    Custom post type is a good way to organise the content in its proper place.
    it gives the flexibility to check a particular custom post type and make the required changes and updates whenever needed.
    having a custom post type slug I think improves seo performance and helps Google rank the website.
    I want to ask if we can have a sidebar navigation in the dashboard for custom post types as we do have for pages and posts?

    • WPBeginner Support says

      Custom post types should create their own sections in your wp-admin area similar to posts or pages :)

      Administratör

  5. David Eyler says

    This plugin is genius! Works great with the Blocksy theme for reclassifying Posts to Product Reviews –
    Yay thanks!

  6. Germans Frolovs says

    Can I deactivate the plugin after the procedure? In other words, will deleting the plugin force post types to switch back to the previous state?

    • WPBeginner Support says

      You can remove the plugin after changing the post types, they will not revert when the plugin is deactivated.

      Administratör

  7. Daniel says

    If I tried converting categories into tags with this plugin, would it also change the post category to the new created tag ?

    • WPBeginner Support says

      This is for modifying posts into pages or other custom post types. What you are asking about would be a different plugin.

      Administratör

  8. Tracy wilson says

    hi guys , thanks for your help. love the fact you follow up tutorial with written instructions. This is perfect for newbie like me. I am very excited this worked. You guys are amazing, I am now a lifelong fan and telling anyone who will listen how good you are. tx

  9. Suel Pratt says

    I just want to say thank you! This is the 3rd time im giving wp another try. I’ve been very frustrated with it in the past but thanks to your website and up-to-date video tutorials, I can finally have the wp site I’ve been dreaming of! Thank you!!!

  10. Brian says

    Shouldn’t the Post Type Switcher plugin be deacivated after this procedure, I’ve heard that there should not be more than five plug ins installed

    • WPBeginner Support says

      Hi Brian,

      No, it is a common myth. You can have as many plugins installed as you need. Just make sure those plugins are from reliable sources and recommended by reputable folks.

      Administratör

  11. Clifton Thrailkill says

    I am on the Premium Plan, and it does not allow plugins. How can I convert a page to a post without the plugin?

  12. Ting Ting says

    Hi,
    I just used this method on my page. But now the comment section is gone. How can I fix this?
    I hope you can help me, thanks!

  13. Mitch says

    How does this affect SEO? I do have Yoast Pro so I assume Yoast will 301 redirect it, but before I do this could you give me a little detail on what happens with the links?

  14. Stuart Mackey says

    I have a custom post type that didn’t put the ”body” of the post in the same field as normal posts, so when I convert it the post is empty. Is there a way to ”remap” this field from the old custom post ype to a normal post?

  15. Ujjwal says

    Hi,

    In my website I have few custom post types like Services, Professionals. The URL for these posts start as website.com/services/title-of-post.

    But there are some limitations in the options available with the custom post types. For example In normal post types, I can have a side bar, a menu bar, enable/disable author info etc. I do not have these options with the custom post types.

    So I plan to change the custom post types into normal posts and pages using a plugin. However when I do that, the plugin also changes the url of the post. For example from example.com/services/title-of-post to website.com/title-of-post

    Can you please advise of a way using which I can change the custom post type without the changing the url.

    • WPBeginner Support says

      Custom post type can have all the options you want. Please take a look at our tutorial on how to create custom post type in WordPress. If you are using Custom Post Type UI plugin, then edit your post type and under the advanced options you can enable support for different features. If you are using the code method to create your custom post type, then see other options section in the code on our tutorial.

      Administratör

  16. Jean says

    Hi WPBeginner,

    I was looking exactly that kind of post and thank god I found you… and hopefully the right plugin. Not sure if I can ask you this but here’s my issue:

    I have imported 20 different websites into 1. Out of 500 pages in the new website, 450 are pages, not posts. I need to convert all these pages into posts as the website template offers an incredible amount of options to posts but not pages. Also the developer says he can’t give the same rights to pages as posts as this would involve rewriting the template almost completely.

    I thus need to convert 450 pages into posts however my concern is the URL structure when I change from pages to posts. I’m afraid that it messes up all my internal linking.

    – What I’d like to know is if the plugin automatically rewrites or redirects to the right URL ?
    ex: /parentpage/thisisagreatplugin (page) becomes automatically /thisisagreatplugin (post) but what if I had another page links to /parentpage/thisisagreatplugin ? do I get a 404 page or does it automatically redirects.

    – When rewritten or redirected does it have a negative impact on SEO?

    Thanks so much for your answer if you have time,

    Jean

  17. WPBeginner Staff says

    Yes it is possible you can use a Permalinks structure with category name before the post name and then create a category called review and import your CPT into that category. One problem with this solution is that it will change URLs of all other posts as well.

    A better approach would be to setup a 301 redirect on your old URLs to let search engines know that the content has move to the new location.

  18. Severine C says

    Hi,

    thanks for this tutorial.

    I had to do it on a site using the WPML plugin, and it just didn’t work…

    If you use WMPL, you have to do an extra manipulation : go to the WP database, and in the wp_icl_translations table, change the element_type field for the post to convert ; for example, if you switch from a page to a custom post type named ”Recipe”, change ”post_page” to ”post_recipe”.

    And to do it for a set of posts, here is the sql command :

    UPDATE `wp_icl_translations` SET `element_type`=replace(`element_type`,’post_page’,’post_recipe’) WHERE element_id IN (….)
    ;

  19. Joseph Herb says

    Thank you WP beginner editorial staff for this post. I am very frustrated for my clients’ this type requirement. First when he told about this type of customization I think how it possible? Then went to search for this issue and found your blog. I take deep breath. Post Type Switcher & Convert post types both plugins are very wonderful. You make me easy to solve this.

    Regards.

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.