Skip Navigation

[Resuelto] Export a post type (data, not structure)

This support ticket is created hace 4 años, 9 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Este tema contiene 4 respuestas, tiene 2 mensajes.

Última actualización por Griffin hace 4 años, 9 meses.

Asistido por: Shane.

Autor
Mensajes
#1509047

Tell us what you are trying to do? Export a custom post type to csv.

Is there any documentation that you are following? no

Is there a similar example that we can see? no

What is the link to your site?

#1509375

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Griffin,

Thank you for contacting our support forum.

To export the data you can have a look at the link below.
https://toolset.com/documentation/user-guides/export-import/modules-exporting-and-importing/#content

However if you want to export your data as csv you will need to use an exporter plugin like the one below.

https://wordpress.org/plugins/wp-ultimate-csv-importer/

Please let me know if this helps.
Thanks,
Shane

#1510967

In case anyone else sees this, I just used sql and it worked fine. For a one off project, paying $100 for this is not good. I will make a video at some point, but here are the basics. I used phpmyadmin just because it was on the clients site.

-----

This finds the post types so you can get the proper name.

SELECT DISTINCT( post_type ) FROM wp_posts;

This finds the meta data that is hooked up.

SELECT P.ID, P.post_title, M.meta_key, M.meta_value
FROM wp_posts AS P
INNER JOIN wp_postmeta AS M ON M.post_id = P.ID
WHERE P.post_type = 'upbeat-news'
and P.post_status = 'publish'
ORDER BY post_title, meta_key

Then use this to get the actual data you care about (note, I have hard-coded this query. As I said, this is a one off. If you are going to use this many times, just pay for the official plugin.) You can then export as csv from phpmyadmin:

select p.post_title, p.post_content, p.post_name, (select meta_value from wp_postmeta as m1
where m.post_id = m1.post_id
and m1.meta_key = 'wpcf-memorial-first-name') first_name,
(select meta_value from wp_postmeta as m1
where m.post_id = m1.post_id
and m1.meta_key = 'wpcf-memorial-last-name') as last_name,
(select meta_value from wp_postmeta as m1
where m.post_id = m1.post_id
and m1.meta_key = 'wpcf-memorial-date-of-death') as death_date
from wp_posts as p
right join wp_postmeta as m ON m.post_id = p.ID
WHERE p.post_type = 'alumni-memorial'
and p.post_status = 'publish'
GROUP BY p.ID

#1513063

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Griffin,

Happy to see that you were able to create a custom solution for your case.

Also thank you for sharing your solution as well, I'm sure this will help other customers as well.

Are there any other queries on this ? If not then you can mark this as resolved.

Thanks,
Shane

#1513345

My issue is resolved now. Thank you!