Pesky WordPress bugs, this is how we take care of them.

It’s all about isolating the problem, some keyword searching, and a smattering of luck. This post just for my own reference.

I’m helping my friend Mariana Funes with a collection of sites in her WordPress Multisite at http://marianafun.es (note she is using my WP-Dimension theme for a landing domain page).

Another site in her fleet uses a premium theme that she is fond of; but one her course sites a few of her protected posts where just ignoring the built in WordPress functionality that provides it. I tried the regular stuff, flicking off plugins, deleting cache and cookies. No change.

Then I tried swapping the theme; and boom! It worked. So now I know it’s a theme issue.

But what in a theme would make it not provide built in WordPress core code for password protected posts? These searches did not get me much closer:

In sifting through the results for the third search I hit on something that seemed on track from StackExchange:

Ended up discovering that the template needed the content() function in it for the password prompt to appear. For those that are in my situation and need to password protect content or PHP scripts in a whole template, this works http://wordpress.org/support/topic/346373

The link did not work, but in combing through the theme’s templates, I saw in content-single.php that the way the posts content was being displayed was a bit different than normal:

which I think applies a few more text checks (?). I tested by commenting out this line and replacing with:

and Boom! Now we were getting the proper display, not seeing the content, but instead:

screen shot of the WordPress prompt to enter a password to see a protected post

But how to fix? Ideally I would go make a child theme that would have the replacement for this file. That’s the clean way. But for a short term and quicker fix, I did What You Should Not Do, edited the theme file, replacing the original line with:

It seems to work. I left a comment on the theme author’s site in Theme Forest, it seems like something they should fix, with more awareness of any implications of my hack.

But who would have known that password protection was tied to the way WordPress content is rendered? Now I do. You too, my odd reader who made it to the bottom of this post. Hi.


Featured Image: Pixabay image by TambiraPhotography shared into the public domain using Creative Commons CC0.

If this kind of stuff has any value, please support me monthly on Patreon or a one time PayPal kibble toss
Profile Picture for Alan Levine aka CogDog
An early 90s builder of the web and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *