Get category id when SEO URL is turned on

Use this function to get current cateogry in wp : function getCurrentCatID(){ global $wp_query; if(is_category() || is_single()){ $cat_ID = get_query_var(‘cat’); } return $cat_ID; } echo getCurrentCatID(); Just found for you, try this, if(isset($wp_query->get_queried_object()->cat_ID)) { $cur_catId = $wp_query->get_queried_object()->cat_ID; } if(issset($wp_query->get_queried_object()->ID)) { $cur_postId = $wp_query->get_queried_object()->ID; }

How to get a custom page through plugin?

You can use wp_insert_post for creating the page. <?php $content=”<Sign up form content>”; wp_insert_post(array( ‘post_title’ => ‘My page’, ‘post_content’ => $content, ‘post_type’ => ‘page’, //VERY IMPORTANT ‘post_status’ => ‘publish/draft’ )); Check it.

Apply html elements in php statement

Do this instead: add_post_meta($newpostid, ‘name’, $formdata[‘your-first-name’] . ‘ ‘ . $formdata[‘your-last-name’]); This uses PHP string concatenation to add a space; the echo isn’t necessary in in this instance because WP will do it itself, later. You probably can’t force a non-breaking space there, either, since WP will escape all its output.