Skip Navigation

[Resolved] User id as title

This support ticket is created 4 years, 8 months ago. 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 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 4 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#1623287

Hi,
is it possible to use the current user id (or name) as title of new created Toolset CPTs posts?

Thanks

#1623943

Hello,

There isn't such kind of built-in feature within Toolset, it needs custom codes, for example:
1) when user save a "CPTs" post, use action hook "save_post" to trigger a PHP function:
https://developer.wordpress.org/reference/hooks/save_post/

2) In this PHP function, get the current user's ID:
https://developer.wordpress.org/reference/functions/get_current_user_id/

And save it as post's title:
https://developer.wordpress.org/reference/functions/wp_update_post/