How do I redirect to a specific page instead of wp-register? Here's what the php looks like:
// concatenate HTML
$html = '';
$html .= '<div class="text">';
$html .= '<h1>' . get_the_title() . '</h1>'; // post title
$html .= '<p class="notice">';
$html .= 'You have to be logged in to view this page. It\'s FREE, so please ' . wp_register('', '', false) . ' if you\'re not a member yet.';
$html .= '</p>';
$html .= wp_login_form( array( 'echo' => false ) ); // login form, which by default will redirect back to the current page
$html .= '</div>';
// print HTML
----The link I'd like to direct to instead of wp-register is along the lines of http://www.mysite.com/example/register
Kailey Lampert answers:
Add the redirect argument to wp_login_form:
wp_login_form( array( 'echo' => false, 'redirect' => 'URL' ) );
Of course, replace 'URL' with the actual url you want to redirect users to :)
Edit: after re-reading, I think you're asking something else... if so, nevermind me
Patrick MacAdams comments:
Instead of going to wp_register, I'm trying to go to a specific page. the login form is already on that page. I'm using gravity forms for registration so it sits inside a page and has extra fields.
Kailey Lampert comments:
The easy answer would be to simply change
$html .= 'You have to be logged in to view this page. It\'s FREE, so please ' . wp_register('', '', false) . ' if you\'re not a member yet.';
to
$html .= 'You have to be logged in to view this page. It\'s FREE, so please <a href="http://www.mysite.com/example/register">register</a> ' if you\'re not a member yet.';
But I'm guessing there are multiple references to wp_register() in your site? In which case you'll need something like this:
add_filter('register', 'change_register_url');
function change_register_url($link) {
$link = str_replace(site_url('wp-login.php?action=register'), 'http://www.mysite.com/example/register', $link );
return $link;
}
That can go into your theme's functions.php file