Support » Plugin: MarketPress - WordPress eCommerce » How to set page password protected in wordpress

Viewing 15 replies - 1 through 15 (of 17 total)
  • Hello, can anyone help me please?

    Plugin Support Jorge – WPMU DEV Support


    Hi there @hsl222

    To do something like this you would need to either use a plugin like this that allows categories to be blocked or use .htaccess like the link below to do it, but thats server level protectction to the url rather than from inside WordPress.

    Hope this helps, let us know.


    Hi Tom,

    I’ve an enquiry. From the Store setting on wordpress, under “Force Login” – Whether or not customers must be registered and logged in to checkout. (Not recommended: Enabling this can lower conversions)

    This only apply to when client wants to check out if I set to ON? Can i set login required from the start of the shopping cart example listing the products?

    HI, I just want to follow up on my query please. I’ve yet to receive a reply. ๐Ÿ™


    I tried to go to setup secured login/password protected for However, this page or is still not password protected. it seems that it only password protect /store. I contacted the developer for the plugin and it says it doesn’t work for the other directory.

    I then contact bluehost to set /store and other directory to password protected but he said i’m using wordpress, and he sent me this info ask me to install plugin.

    Please help.


    Plugin Support Nastia – WPMU DEV Support


    Hey there Helen, working with Tom on this one.

    You need to change the visibility to password protected store page and then paste this at the top of your header.php after the opening php tag, the best option is to use a child theme.

    global  $post;
    if  ($post->post_parent && post_password_required($post->post_parent))

    Then if someone try to access in this case to /store/products it will be redirected to the parent page /store unless they enter the password.
    Note: This will only work with direct children pages

    Let us know if this works for you.

    Hi Jorge,

    You mentioned it will only work with direct children pages. What about this ? will it work as well? I realised this link is automatically created from your plugin too.


    Plugin Support Nastia – WPMU DEV Support


    Hey there Helen,

    MarketPress creates 5 pages, and four of those pages are “direct child” from the store page.

    In this case it should work with the shopping-cart page because it’s “under” the store.

    Let us know if that works for you.

    Hi Jorge,

    I tried to paste your code below
    global $post;
    if ($post->post_parent && post_password_required($post->post_parent))

    to header.php file after opening of php tag. I don’t know exactly where is it. I tried to paste a few places but then the whole code shows on top of the website.

    I copied the top section of the code here. Could you please tell me exactly where I should paste your code please?

    <?php session_start(); ?>
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”>
    <html <?php language_attributes(); ?> xmlns=””>
    <head profile=”″>

    <meta http-equiv=”Content-Type” content=”<?php bloginfo(‘html_type’); ?>; charset=<?php bloginfo(‘charset’); ?>” />
    <meta name=”generator” content=”WordPress <?php bloginfo(‘version’); ?>” /> <!– leave this for stats please –>
    <meta name=”viewport” content=”width=device-width, minimum-scale=1.0, maximum-scale=1.0″ />

    if(is_home() || is_front_page()) { echo bloginfo(“name”); echo ” | “; echo bloginfo(“description”); }
    { echo wp_title(‘|’, true, ‘right’); } ?>

    <link rel=”alternate” type=”application/rss+xml” title=”RSS 2.0″ href=”<?php bloginfo(‘rss2_url’); ?>” />
    <link rel=”alternate” type=”text/xml” title=”RSS .92″ href=”<?php bloginfo(‘rss_url’); ?>” />
    <link rel=”alternate” type=”application/atom+xml” title=”Atom 0.3″ href=”<?php bloginfo(‘atom_url’); ?>” />
    <link rel=”pingback” href=”<?php bloginfo(‘pingback_url’); ?>” />

    <!–[if IE 8]>
    <link href=”<?php echo get_template_directory_uri(); ?>/style/ie8-media.css” media=”screen and (min-width: 250px;)” rel=”stylesheet”/>
    <!–[if IE 9]>
    <link rel=”stylesheet” href=”css/ie9.css” media=”screen, projection” type=”text/css” >

    <!–[if lt IE 9]>

    <?php $favicon = get_theme_option(tk_theme_name.’_general_favicon’); if(empty($favicon)) { $favicon = get_template_directory_uri().”/style/img/favicon.ico”; }?>
    <link rel=”shortcut icon” href=”<?php echo $favicon;?>” />

    $g_analitics = get_theme_option(tk_theme_name.’_general_google_analytics’);
    if( isset ($g_analitics) && $g_analitics != ”){
    echo $g_analitics;

    <?php wp_head();?>

    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

    ga(‘create’, ‘UA-55537824-1’, ‘auto’);
    ga(‘require’, ‘displayfeatures’);
    ga(‘send’, ‘pageview’);

    <link href=’,700,300|Droid+Serif|Open+Sans:400,700′ rel=’stylesheet’ type=’text/css’>

    Hi, please assist me with me where exactly should i paste my code please?


    Hi @hsl222,

    Hope you’re well today! You could try adding that bit of PHP code below the wp_head call like so:

    <?php wp_head();?>
    global  $post;
    if  ($post->post_parent && post_password_required($post->post_parent))

    It’s also possible to add that code via the wp_head hook. It could be done using a tiny custom plugin that way.

    In any case though, I think the above would work just fine. The reason it didn’t work before is because you needed the <?php ?> tags. The snippet above includes that.

    Perhaps that’ll do the trick?


    Hi David,

    I did exactly what you said. Added the following code below <?php wp_head();?>
    but doesn’t show any result. – I tried not to login – but when i go straight to this url, it still accessible which is not suppose to. Please assist. ๐Ÿ™

    <?php wp_head();?>
    global $post;
    if ($post->post_parent && post_password_required($post->post_parent))

    By the way, is this forum content accessible to public? I can’t have anyone see the above link. It’s private login.

    Desperately need your help here.


    Hi, I want to continue to use your plugin but I need some help here please.

    Under store setting, I set “Force Login” option to “No”.

    I tried to purchase a product, enter all details in forms and there is a message on top “Made a purchase here before? Login now to retrieve your saved info ยป”

    1. Does the system store the details when I first enter them so I don’t have to re-enter again?
    2. Where does the info saved to? Where is the wp can I see which user save the info?
    3. Under “Review Cart” page, I can see “have a user account” then Username field and password field. because I set Force Login to No, the next column shows “Check out Directly”. My question is the system doesn’t ask me to enter username and password, how do I know what’s my username and password please?


    Plugin Author Bojan Radonic – WPMU DEV Support


    Hey Helen,

    Working with the rest of the guys here ๐Ÿ™‚

    Here are the answers to your questions:

    1. Yes it does.
    2. The info is stored in the cookies.
    3. With force login set to no, you can checkout without being registered on the site but you can still login and make the purchase in case you have an account.

    This means having an account and being logged in is optional and it can be done either way.

    I’m not really sure what you mean by “how do I know what’s my username and password please” so can you please advise on that?


    HI, I set Force login to “No”.
    The flow seems not right.

    1. This is my product page
    2. When user click “Buy Now”, it will come to this “Review Cart” page.
    3. I understand by setting Force Login to “No”, client gets to checkout directly.
    4. Once I click check out directly, it prompts me to enter all my details like address, email and etc. After that I click “Continue checkout” and it goes straight to paypal.

    My objective is i don’t want regular clients to keep having to enter all their details all over again everytime they come to shop here. From the flow above, where is the process that ask me to enter my Username and password? Because under point 3 above, there’s a username and password login. I didn’t get the chance to enter password. I hope you get what I mean.

    Urgently need your help.


Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘How to set page password protected in wordpress’ is closed to new replies.