Skip Navigation

[Resolved] Add captcha to lost password page

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

Problem:

Run shortcodes in custom PHP codes.

Solution:

Please try WP function do_shortcode(), for example:

return do_shortcode('<p>[c4wp-captcha]</p>');

Relevant Documentation:

https://developer.wordpress.org/reference/functions/do_shortcode/

This support ticket is created 2 years, 9 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 4 replies, has 3 voices.

Last updated by TomW5440 2 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#2345205

Tell us what you are trying to do?
I want to add a captcha to the lost password form.

I'm using Captcha 4WP plugin to add captcha to login page and within these settings of this plugin placement options for Lost password form is checked so whether it's using this plugin or Toolset I need a captcha on the reset password page. Do you know how I can achieve this please? Thank you.

Is there any documentation that you are following?
https://toolset.com/course-lesson/creating-the-lost-password-page/

#2345315

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

the Captcha 4WP plugin presumably uses a hook on the core WP lost password page to insert the captcha, but the same isn't available on the custom lost password page you create with Toolset.

If you check their documentation they may have an alternate way of injecting the captcha with some HTML that you could add to the form Toolset generates.

Toolset includes filters for you to be able to insert arbitrary HTML content in the form at the top, middle, or bottom.

You'd probably want to add it at the bottom of the form.

This is the filter as it appears in our codebase:

$form_bottom = apply_filters( 'forgot_password_form_bottom', '', $args );

So you would insert additional content like so:

	add_filter( 'forgot_password_form_bottom', function(){

		return "<p>Your HTML goes here</p>";
	});
#2345439

OK great so it's just a case of adding the shortcode to the snippet like

add_filter( 'forgot_password_form_bottom', function(){
 
    return '<p>[c4wp-captcha]</p>';
});

The above isn't working though it just displays the shortcode on the front end. According to c4wp documentation this should work.
hidden link

#2345693

Hello,

If you want to output the shortcode result in frontend, please try WP function do_shortcode(), for example:

return do_shortcode('<p>[c4wp-captcha]</p>');

More help:
https://developer.wordpress.org/reference/functions/do_shortcode/

#2346017

My issue is resolved now. Thank you!