Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am working on anew blog. I am logged in as administrator, and above every post there is a option to 'edit this entry'.

Can I have WordPress set up so that even is I am logged in as administrator, I will still view the front end of the website as if I was not logged in. This was I can see how the user would see the page.

One option is to just view the website in another browser, but I guess there has to be another page.

share|improve this question
    
Use a differenty browser where you do not login... so you will see the site as non logged in... usually it's the way i use... –  SteveAgl Oct 25 '11 at 15:02
    
Thank you for this answer, but as I said in the question, I knew this already. I prefer working in one browser tho. thanks anyway. –  Saif Bechan Oct 25 '11 at 15:06
add comment

4 Answers

up vote 0 down vote accepted

See this related question. You should be able to add this code to your themes functions.php

   add_filter( 'edit_post_link', '__return_false' );
share|improve this answer
    
This will do fine for now, Thank you. –  Saif Bechan Oct 25 '11 at 15:08
add comment

Those edit links are Theme-dependent, via the edit_post_link() template tag. However, there are several other, similar variances in site appearance between logged-in and non-logged-in users: the presence of the Admin bar, edit-post links, edit-comment links, login/logout/register links (added directly to the template, or via Widget), etc.

These don't really constitute "front-end editing"; they're just links that appear (or change) based on the logged-in status of the user.

Your best bet, most likely, is to view the site in a browser from which you are not logged-in to your site.

share|improve this answer
    
+1. Common sense FTW. There's so many difference between logged in or not, and each plugin can have it's own differences, that opening a new browser is THE ONLY real way to see it as not logged in. –  EarnestoDev Oct 25 '11 at 22:31
add comment

You can conditionally nuke global variable with user info, something like this:

function no_user() {

    global $current_user;

    if( is_admin() )
        return;

    $current_user = -1;
}

I don't know precisely which is most appropriate moment to do this. Doing this on template_redirect should be early enough to cancel it out for most (if not all) things in templates.

Also I went with -1 for the sake of it being not empty (which will trigger it being re-setup on calls of some related function) but it probably would be better to set it up with info of existing non-privileged user.

share|improve this answer
    
+1 Oh this is interesting. I will try this out the next time, for now BandonRandon's answer is is enough. Maybe when I get into a further stage of development this will be handy. –  Saif Bechan Oct 25 '11 at 19:04
add comment

Turn on Privacy or Incognito mode, or use another browser, it's the only reliable way of doing it. People may give you filters that may get rid of one thing ro another but there'll never be a 100% perfect code fix.

Asking for a solution that allows you to view the frontend as if your not logged in introduces a whole new raft of issues such as people not being able to login and comment as it won't remember them, etc

What you're asking for is essentially "I have a car and I want to drive around but I don't want to do it using wheels, how do I add tank treads?" It's doable but its not really the solution.

share|improve this answer
    
Google Incognito Window is indispensable. Open IW for a fresh session, close it and reopen to clear the cookies and start over again. –  Annika Backstrom Oct 25 '11 at 22:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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