marketing guy
Member
Posted 9 months ago #
I'm creating a plugin that adds a page using wp_insert_post. However, I need this page to only be accessible by logged in users. I tried to use !is_user_logged_in() but that doesn't work. Seems like post_content only accepts HTML, and not PHP. Which makes sense. I guess I need to know how I can execute PHP code on that newly created page. Any way to attach additional code?
Hello,
This may help
http://wordpress.org/extend/plugins/shortcode-exec-php/
This plugin was made for that http://wordpress.org/extend/plugins/exec-php/ but has not been updated in a while. Could still work though for you
marketing guy
Member
Posted 9 months ago #
Oh I see how it works. I kinda want something like that but not have my plugin depend on that plugin, if it makes sense? Any other suggestions?
I'll keep this one in my back pocket in case there are no alternatives. Thanks
marketing guy
Member
Posted 9 months ago #
Cool, that helps. I'm just going to use add_filter to hook a function with all the PHP code to the_content action. :)
Thanks again!