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

Come importare ed esportare i tipi di post personalizzati in WordPress

Nota editoriale: guadagniamo una commissione dai link dei partner su WPBeginner. Le commissioni non influenzano le opinioni o le valutazioni dei nostri redattori. Per saperne di più su Processo editoriale.

È estremamente facile spostare il vostro sito WordPress utilizzando un plugin di backup. Ma se voleste spostare solo un tipo di post personalizzato? In questo articolo vi mostreremo come importare ed esportare tipi di post personalizzati in WordPress. Vi mostreremo anche come importare le tassonomie personalizzate associate ai vostri tipi di post.

L’esportazione e l’importazione di un tipo di post personalizzato in WordPress richiedono due passaggi. La prima fase prevede la migrazione del tipo di post personalizzato e delle tassonomie. Il secondo passo consiste nell’importare i dati del tipo di post.

Spesso i tipi di post personalizzati in WordPress sono associati a tassonomie personalizzate. Vi mostreremo come esportare/importare le tassonomie personalizzate insieme al tipo di post.

Migrate Custom Post Types

Esportazione di tipi di post e tassonomie personalizzate in WordPress

Alcuni utenti preferiscono creare i loro tipi di post e tassonomie personalizzati aggiungendo del codice nel file functions.php del loro tema o in un plugin specifico per il sito. In questo caso, è sufficiente copiare il codice e incollarlo sul sito in cui si desidera importarli.

Tuttavia, in alcuni casi potrebbe non essere possibile individuare il codice. Non preoccupatevi, potete comunque creare lo stesso tipo di post personalizzato sul nuovo sito.

Tutto ciò che occorre sapere è il valore della chiave del post. Si tratta del nome utilizzato per il tipo di post nel database di WordPress. È possibile trovarlo semplicemente visitando il tipo di post nell’area di amministrazione di WordPress.

Getting the post type key

Una volta ottenuta la chiave del post, visitate il sito in cui volete importare il tipo di post e utilizzate il plugin Custom Post Types UI per creare il vostro tipo di post personalizzato.

Creating post type in CPT UI

È anche possibile ottenere la chiave della tassonomia personalizzata semplicemente visualizzando la tassonomia personalizzata nell’area di amministrazione.

Getting taxonomy key in WordPress

Utilizzare il plugin CPT UI per creare la stessa tassonomia sul sito di destinazione in cui si desidera importare la tassonomia.

Create Taxonomy in CPT UI plugin

Ripetere la procedura per tutti i tipi di post personalizzati e le tassonomie che si desidera importare.

Suggerimento bonus: se avete usato il plugin CPT UI per creare i vostri tipi di post, potete usarlo anche per migrarli. Ma questo funziona solo se il tipo di post personalizzato originale è stato creato con questo plugin. Visitare la sezione Importazione/Esportazione nelle impostazioni del plugin e seguire le istruzioni sullo schermo.

Tipi di post personalizzati e tassonomie create dai plugin

Molti dei più diffusi plugin di WordPress utilizzano tipi di post e tassonomie personalizzate per gestire tipi di contenuti personalizzati. Ad esempio, Soliloquy li usa per creare slider, i plugin eCommere li usano per creare prodotti, ecc.

Se si vuole continuare a usare questi plugin, non è necessario importare i CPT. È sufficiente installare il plugin sul sito di destinazione per avere a disposizione i tipi di post e le tassonomie personalizzate.

Molti di questi plugin sono dotati di funzioni di importazione/esportazione, ma se un plugin non dispone di questa funzione, è comunque possibile esportare i dati.

Esportare/importare i dati dei tipi di post e delle tassonomie personalizzate in WordPress

WordPress è dotato di un potente strumento di importazione/esportazione che consente di esportare e importare i dati di WordPress. Basta andare su Strumenti ” Esportazione.

Exporting custom post type in an XML file using WordPress built in export tool

Vedrete elencati tutti i vostri tipi di post. Selezionare i tipi di post che si desidera esportare e premere il pulsante Scarica file di esportazione.

WordPress preparerà un file di esportazione XML e il browser inizierà a scaricarlo.

Ora passate al sito di destinazione dove volete importare questi dati. Andate su Strumenti ” Importazione. Verrà visualizzata una serie di opzioni, fare clic su WordPress.

WordPress import tool

Si aprirà un popup che vi chiederà di installare il plugin WordPress importer. Fare clic sul pulsante di installazione e poi su Attiva plugin ed esegui importatore.

Installing WordPress importer plugin

Nella schermata dell’importatore, è necessario fare clic sul pulsante Scegli file e selezionare il file XML scaricato in precedenza. Quindi, fare clic sul pulsante Carica file ed esporta.

Importing WordPress using XML export file

WordPress importerà ora i dati dei tipi di post personalizzati. Verranno importati tutti i tipi di post personalizzati selezionati in precedenza. WordPress aggiungerà automaticamente i termini alle tassonomie personalizzate.

Questo è tutto, speriamo che questo articolo vi abbia aiutato a importare ed esportare tipi di post e tassonomie personalizzate in WordPress.

Se questo articolo vi è piaciuto, iscrivetevi al nostro canale YouTube per i video tutorial su WordPress. Potete trovarci anche su Twitter e Facebook.

Divulgazione: I nostri contenuti sono sostenuti dai lettori. Ciò significa che se cliccate su alcuni dei nostri link, potremmo guadagnare una commissione. Vedi come WPBeginner è finanziato , perché è importante e come puoi sostenerci. Ecco il nostro processo editoriale .

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.

Il kit di strumenti WordPress definitivo

Ottenete l'accesso gratuito al nostro kit di strumenti - una raccolta di prodotti e risorse relative a WordPress che ogni professionista dovrebbe avere!

Reader Interactions

24 commentiLascia una risposta

  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. Kerry says

    I am trying to export CPT data, but the WP export tool doesn’t list the CPT. I’m using the CPT UI plugin. Any help?

    • WPBeginner Support says

      For that specific plugin, you would want to check under CPT UI, Tools and you should see that plugin’s specific method for importing and exporting post types.

      Admin

  3. Bulut says

    There are people, Trouble Maker
    There are Bloggers, Trouble Eraser

    Thanks guys. You saved my day and time!

  4. Gabriela says

    Hi!

    We are switching themes – we want a new site basically – hopefully with a cleaner backend. The switch is from a custom-built theme to a new theme.
    Would it be best to install a new theme within our same back end, or would it be cleaner to export and import into a new backend?

  5. Raf says

    Clear incoherence between title and intent and practical advises:
    1) says “Exporting Custom Post Types and Taxonomies in WordPress”
    2) says “in some cases you may not be able to locate the code.”
    3) says “Don’t worry you can still create the same custom post type on the new site.”

    So if the post-type is created using the UI : you can not export it but only create it again. Why the article doesn’t clearly state it?

  6. Francis says

    So let say for instance if I was using a paid plugin that has to do with custom posts and want to switch to the free version how will i go about it? Am still very new to wordpress

  7. David says

    How can you export and have the option of exporting by month like you have when you export post and page?

  8. charles says

    When exporting custom post types it doesn’t export the featured image url path. Any idea how to resolve this?

    • Paul says

      I’m trying to do this too, which is why I landed here. I’m trying to rename a custom post type without losing the post data. Not having much luck.

    • Carlitos says

      It does not. you will want to bring that over either in your functions file or enter it in manually if you are using a plugin.

  9. Jim D says

    Is this something you would need to do if you are using a custom post type currently and wish to switch to a different theme?

    • WPBeginner Support says

      It depends on how you created the custom post types in the first place. If these custom post types were created by your old theme then you will need to export them before switching theme. If the custom post types were created using a plugin then they would remain unaffected when you switch the theme. Lastly, if you created the custom post type by adding code into your theme’s functions file then you just need to copy that code and paste it in your new theme.

      Admin

  10. Philip Downer says

    This article should have a bit of clarification. As Kris touched on, you can only import a custom post type if that specific custom post type actually exists on the destination site. You’ll need to either export and include the code that registers the post type; or if you’re using a plugin to handle custom post types, you’ll need to ensure that the same settings are used.

  11. Kris says

    Not to forget: themes also make their own custom post types (portfolio for example). Not only moving a site, but also switching themes can also be difficult

    I ended up coding the post type and taxonomies in a separate site-specific plugin with the aid of generatewp.com; I was surprised how easy it went and found it less confusing then CPT-UI

Lascia una risposta

Grazie per aver scelto di lasciare un commento. Tenga presente che tutti i commenti sono moderati in base alle nostre politica dei commenti e il suo indirizzo e-mail NON sarà pubblicato. Si prega di NON utilizzare parole chiave nel campo del nome. Avremo una conversazione personale e significativa.