Set cookie then immediantly refresh the page

The setcookie function prepares the HTTP cookie header to be sent at the next page load. That’s why the $_COOKIE superglobal is not updated automatically. You could manually update $_COOKIE for use on the current request. Just put this below your setcookie() line: $_COOKIE[‘mobileesp_wp_full_site’] = ‘true’; By the way, I’d prefer not to work with … Read more

How could I create a ‘private comments’ section on a custom post type?

Comments have an associated author to them. In a section called “Private Comments” – Query for all comments belonging to the current post where wp_comments->comment_author_email equals the email of the current user. Checkout the wp_comments table. It has 15 or so fields you can filter when displaying comments. EDIT: The code would look something like … Read more

Create a new page in a plugin

I managed to do it, not perfect but it works… add_action(‘template_redirect’, ‘my_template’); function my_template(){ global $post; if( get_post_type($post->ID) == ‘courses’){ include(ABSPATH. ‘wp-content/plugins/courses/single-course.php’); } And the file the include points to is my new template file in the plugin.