So I am pretty new to WordPress and as a learning exercise I am trying to create a membership plugin that will allow the site to restrict access to pages based on user type.
The first step I am doing is just trying to remove page content and display a "membership only area" message. At first I was going to try injecting JavaScript that would remove everything from <*div id="content">
, but I was not sure if custom themes are required to use that div id.
I am now trying to use the filter the_content
to rewrite the content. I can remove the content completely by not returning the content but then it just shows a "content not found" message. So I am now trying to re-write the array itself by doing $content['post_content'] = "Members only";
. Instead of changing the post_content
it prints it to the screen twice.
I might be on the completely wrong path for what I am trying to do but still, how would I go about re-writing the $content
array so that WordPress would display the fake content that I want it to display?