Customizing Error Messages On Protected Pages

When an unauthorized visitor tries to access a protected page or post, you can choose from among two things that can happen:

1) Display an “In-Page Error Message“: They can be presented with an error message that shows a “lock” image. You can show the standard DAP version, or you can customize this message and add your own text.


2) Redirect to Error Page: They can be redirected to any other page of your choice (WordPress page or post, or a completely non-WP page)

1. Display “In-Page” Error Message

“In-Page” basically means that this message will be shown on the same page that the user is trying to access (to which they do not have access). So basically, the content of the very post or page they’re trying to access, will be replaced by this “In-Page” error message.

The default error messages shown by DAP are as follows.

A) If a visitor is NOT logged in, then they will see…

(Image A)

B) If a visitor IS logged in, then they will see…

(Image B)

If you see Image A above, there is a line of text that says: “Click here to get access”.

And in Image B above, there is a line of text that says: “If you are a free member, then click here to purchase access”.

In both cases, the text “click here” is actually a link. And by default, that link will point to whatever you put in the “Sales Page URL” in your DAP Product (to which the above post/page is part of). See Image C below.

(Image C)

Displaying Custom Error Message

If you wish to customize the above standard error messages, then here’s what you need to do:

  1. Go to /dap/inc/ folder. There are two files there:error-loggedin.php , and
  2. Make a copy of both files on your computer, and add the text ‘custom‘ to the front of each of the file names of the newly copied files. So the new files are now called: customerror-loggedin.php , and
  3. Open customerror-loggedin.php and customerror-notloggedin.php and modify them as you please, change the text, formatting, font size, color, etc.
  4. Upload the new files to the same folder – /dap/inc/ – as the original error files.That’s it. DAP will then ignore the old error files, and start displaying your new “custom” error messages.

2. Redirect to Error Page

Instead of showing an error page (default or custom, from (1) above) you can also redirect the un-authorized user to a completely new page/post of your choice.

If you see Image D below, you will see that on the DAP Products page, there is a field called “Error Page URL“.

By default, this is pointing to /dap/product-error.php

(Image D)

Change this to any link you want. Examples…

http://YourSite.com/myerrorpage.html , or


Whatever you put in the above field (Error Page URL) is what page the user will be redirected to, when they access a page that they don’t have access to (either because they have not logged in, or because they are logged in, but don’t have access to it yet).

Click Here to Leave a Comment Below 18 comments
Marc Eglon - March 21, 2010

This is so timely Ravi. I’m just running some final tests before I launch my site and had a couple of hurdles to get over. Looks like this could definitely plug one of the gaps.
Great to see the pace of development over here 🙂

Mark - March 25, 2010

Also, just a tip for those that switch the lock.gif image with their own: Be sure to adjust your new custom lock image to its proper width and height in the html. This will insure the image is as crisp and clear as it was before loading, which is what I did at


Robin - August 28, 2010

When I go to /dap/inc/ folder, I don’t see those two files there. (error-loggedin.php and error-notloggedin.php)

All I see is a single file called error.php and it only has one line of text that says “This Content Is Not Available To You.”

Clare Josa - September 20, 2010

Thank you Ravi!
This is perfect – just what I needed and has saved me a support ticket!

Troubleshooting Product Settings — DAP Documentation - October 18, 2010

[…] which to pick the “Error Page URL” and redirect the visitor to. So it just shows the error message with the padlock image, which can be customized. Click here for […]

Rhonda - April 26, 2011

I just visited your site… Just want to say it looks Beautiful!

Stay Well and Best of Everything to You All…

Kirk Ward - December 13, 2011

I have a page where protected file URL’s are displayed in among the content. How do I specify the error page that appears when the user clicks the link?

Gerry - February 28, 2012

I’ve created a custom error page URL (not-yet-a-member)
When I try to login using bogus information, I expect to be taken to that error page. However I still end up at/dap/product-error.php.
I’m sure I’m missing something painfully obvious. Any help?

Veena Prashanth - February 28, 2012

The customized error page is only for protected content. It’s not for regular login/authentication errors.


Gerry - February 29, 2012

If someone is trying to login and they are not yet a member can I customize the error message

Sorry, either you have entered an invalid username/password, or you may not have activated your account yet.

I’d like to add a link and send them to the not-yet-a-member page?

Veena Prashanth - February 29, 2012

>>If someone is trying to login and they are not yet a member can I customize the error message << No, that error page is not customizable. You can try to directly update the php script, but it's not customizable. If you make changes to the php script directly, it will get applied anytime it's called. Also, if you upgrade dap in future, your changes will get overwritten, so make sure to make a copy of the changes you make.

Alexei - June 8, 2012

Hi, I assign each product wit unique sales page, But unfortunately when I , as logged in admin, click on “click here to purchase access” It is keep sending me to my index page.
I must say that not registered users redirect just fine to correspondent sales page.

Veena Prashanth - June 8, 2012

>>It is keep sending me to my index page. << Does it work if you login as non-admin user to dap? When you hover over the 'click here' link, what URL do you see?

Linette - September 3, 2012

I have a similar problem. When I stick with the dap error default page, the click here link is NOT sending users to the sales page url I entered for the product.

Based on the information on this documentation page, I created a custom redirect error page and changed the error page link for that product to the new custom page instead of the dap error default page BUT it is still sending me to the dap error default post with a click here link that points to my main website.

I have an admin account and an account in my name so I can test products. I have tried it logged in and logged out in every way possible. I have tried using 2 different browsers. I’ve tried making it an error page and I tried an error post.

My protected content access is working fine. I just can’t figure out why it is not going to the sales page url nor the custom error page url I set.


Veena Prashanth - September 3, 2012


What’s the Global Error Page URL set to in DAP Admin -> Setup->Config->Access & Navigation->Error Page URL (Global) ?

Is it set to the custom error page?

Do you have any CACHE based plugin active like WP super cache /total cache etc? If yes, pls de-activate, clear cache, and re-test.


Linette - September 5, 2012

I tried the cache guidance. That did not work.

I was unable to find the error page url (global). My Setup drop down box (DAP 4.1) does not have a choice for “Access & Navigation”. I clicked Config>All and don’t see an option for the error page global.

Please advise.
Thank you.

Veena Prashanth - September 5, 2012

The error page global is a feature we added in dap 4.3.1.

Linette - September 5, 2012

I understand. So what is the solution. The sales page url nor the error url box is linking to the page I have put in the respective boxes.


Leave a Reply: