Skip Navigation

[Resolved] %%POST_PARENT_TITLE%% does not work in the notification subject line

This thread is resolved. Here is a description of the problem and solution.

Problem:
Use %POST_PARENT_TITLE%% in the CRED notification subject line or even the notification body to show the parent post title but it doesn't work.

Solution:
I am not able to reproduce this issue at my end with ALL latest version of Toolset plugins.

%%POST_PARENT_TITLE%% working fine in Notification email subject and Body.

Alternatively if its not working for you you can try below method to forcefully display Parent post title:
1. In your CRED form, add a generic field by pasting this shortcode:

[cred_generic_field field='currentpagetitle' type='hidden' class='' urlparam='']
{
"required":0,
"validate_format":0,
"persist": 1,
"default":"[wpv-post-title]"
}
[/cred_generic_field]

2. Add this code in your theme’s or child theme’s functions.php file:

// custom cred notification placeholders
add_filter('cred_body_notification_codes', 'custom_generic_field_notification2');
add_filter('cred_subject_notification_codes', 'custom_generic_field_notification2');
   
function custom_generic_field_notification2( $defaultPlaceHolders ) {
   
    $newPlaceHolders = array(
        '%%FORCED_PARENT_TITLE%%' => $_REQUEST['currentpagetitle'],
    );
   
    return array_merge($defaultPlaceHolders, $newPlaceHolders );
}

3. Then in your email notification, add Parent post title using this shortcode:

%%FORCED_PARENT_TITLE%%
This support ticket is created 6 years, 6 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
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by samB-3 6 years, 5 months ago.

Assisted by: Noman.

Author
Posts
#582436

I am trying to:
Use %POST_PARENT_TITLE%% in the CRED notification subject line or even the notification body but it doesn't work.

I expected to see:
The parent post title

Instead, I got:
Nothing

It seems that %%POST_PARENT_TITLE%% does not work in the notification subject line or body. It works with an old test site I have running CRED 1.6 but does not work two other sites one which runs CRED 1.8 and the other CRED 1.92.

Not sure if I'm doing something wrong but the sites are otherwise exactly the same except for the CRED versions so it seems it should work.

#582769

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Sam,

Thank you for contacting Toolset support. I have just tested this at my end and I am not able to reproduce this issue at my end with ALL latest version of Toolset plugins.

%%POST_PARENT_TITLE%% working fine in Notification email subject and Body.

Alternatively if its not working for you you can try below method to forcefully display Parent post title:

1. In your CRED form, add a generic field by pasting this shortcode:

[cred_generic_field field='currentpagetitle' type='hidden' class='' urlparam='']
{
"required":0,
"validate_format":0,
"persist": 1,
"default":"[wpv-post-title]"
}
[/cred_generic_field]

2. Add this code in your theme’s or child theme’s functions.php file:

// custom cred notification placeholders
add_filter('cred_body_notification_codes', 'custom_generic_field_notification2');
add_filter('cred_subject_notification_codes', 'custom_generic_field_notification2');
  
function custom_generic_field_notification2( $defaultPlaceHolders ) {
  
    $newPlaceHolders = array(
        '%%FORCED_PARENT_TITLE%%' => $_REQUEST['currentpagetitle'],
    );
  
    return array_merge($defaultPlaceHolders, $newPlaceHolders );
}

3. Then in your email notification, add Parent post title using this shortcode:

 %%FORCED_PARENT_TITLE%% 

Thank you

#582799

Thanks for the help. But this gives me the current post title when I need the parent post title.

However, I was able to get the parent title by adding this to my CRED form

		[cred_generic_field field="post_title" type="hidden" class="" urlparam=""]
			{
			"required":0,
			"validate_format":0,
			"persist":1,
			"default":"[cred-post-parent get='title']"
			}
		[/cred_generic_field]

And then using the following in the notification subject and/or body (NOTE: has to be done via the "Fields and Views" buttons can't be typed in directly)

[wpv-post-title id="$post"]

It's odd though that %%POST_PARENT_TITLE%% would work with my older version of CRED but not newer, isn't it?

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.