Saltar navegación

[Resuelto] Default Body Text

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.

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

Zona horaria del colaborador: Asia/Hong_Kong (GMT+08:00)

Etiquetado: 

Este tema contiene 1 respuesta, tiene 2 mensajes.

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

Asistido por: Luo Yang.

Autor
Mensajes
#1827511

Is it possible to specify a default body Text for a Custom post type?

For example I have a CPT called Cards I want the body to always say "Click Here to Open [Post Title]" This is because my Theme pulls the post title and body copy through into my Search results page and displays in a grid but this particular CPT doesn't actually have any content so the search is just pulling through the title which breaks the layout.

Thanks!

#1828205

Hello,

There isn't such kind of feature within Toolset, you might consider custom codes, for example, use WP action hook save_post to trigger a PHP function:
https://developer.wordpress.org/reference/hooks/save_post/

In this PHP function, check the post body is empty, then setup the default text:
https://developer.wordpress.org/reference/functions/wp_update_post/