I have a wordpress Page with an html form where i get username and password from my customers.

Then i send to an external php page located in another my server and get the result from inserted credential to check if the user is really allowed to see protected content.

What i am trying to do after login succeded is to replace the current content of wordpress page (the html form) with something else, without change page and without make it external (i want to show to the user the same style of the page).

There is a a sort of dynamic frame or something else that to allow me that?

Thanks very much.

  • Is it possible that after successful login user is directed to other page of the site? May be send a "redirect" field in the login form? There are multiple solutions to this but It would be better if login page is separate from the dashboard page.
    – M-R
    Mar 24, 2015 at 9:50
  • Thanks for reply. I think to this solution but i want to keep secret the address of the page after successful login.
    – itseeder
    Mar 24, 2015 at 10:34
  • You can encode or encrypt the redirected page and decode it on successful login.
    – Ciprian
    Mar 24, 2015 at 11:52

1 Answer 1


Reread your question and revised the solution as well. It is a Page template now and should be set to the page that needs its content protected. It relies on a "login" post that has the html from.

Template Name: Protected Page

// Standard HTML of Theme

    global $post;

    // check if authentication has been made
    if( verifyAuthentication($_POST['authCode']) ) {

        // display protected content
    else {

        // fetch the login form html from "login" post. Or you can read from a file or some admin settings of your plugin.
        $login_post = get_post( url_to_postid("login") );

        // display the html form
        echo apply_filters('the_content',$login_post->post_content );

// Standard HTML of Theme

Post parameter authCode is supposed to be present and valid when login has been successfully authenticated.

  • To test this i need to implement a new template of the page, and perform it there right? If you can give more info i will be grateful. :)
    – itseeder
    Mar 24, 2015 at 12:33
  • You need to put in your functionality plugin or functions.php of your theme.
    – M-R
    Mar 24, 2015 at 12:44
  • This solution can work using the Wordpress Login system. My situation is different so it doesn't work..
    – itseeder
    Mar 24, 2015 at 13:29
  • I think, I mis-understood your problem earlier. I changed the above solution to a page template. My understanding is, you want to password protect the post/page contents and should be displayed on authentication by an external page.
    – M-R
    Mar 24, 2015 at 14:13
  • 1
    I saw that there is a plugin called WP OAuth Server. I think that i should implement that in my server. The hard thing for me will be react and display custom content depends in server replies (it's my first website with Wordpress where i require custom login and custom content). Thanks very much M-R i think that i need to study a bit now.
    – itseeder
    Mar 24, 2015 at 19:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.