Pass form input via url variable

The first form: <form method=”post” action=”some-url.php”> <input type=”email” placeholder=”Email address” value=”” name=”email”> <input type=”submit” value=”Submit” name=”email-submit”> </form> Then in some-url.php: if( isset($_POST[’email’] ) $email = $_POST[’email’] The post method would be preferred here since it won’t create server log entries that include the user’s email address. You should also do this over SSL since you … Read more

Force Rewrite Query Var On Hierarchical (Nested) Page

Just in case any one needs this: /* Register Query Var —– */ function my_queryvar_params( $query_v ) { $query_v[] = “my_var”; return $query_v; }; add_filter(‘query_vars’, ‘my_queryvar_params’); /* Rewrites —– */ function setup_filter_rewrites(){ add_rewrite_rule(‘^my-parent/my-page\/([0-9]+)\/?’, ‘index.php?pagename=my-parent/my-page&my_var=$matches[1]’, ‘top’); // As @Milo mentioned, the pagename paramenter needs to reflect the path hierarchy }; add_action( ‘init’, ‘setup_filter_rewrites’ ); /* Force … Read more

How to call code when adding WooCommerce menu items via woocommerce_account_menu_items

One needs to create an action hook ‘woocommerce_account_[myendpoint]_endpoint’: add_action(‘woocommerce_account_’ . $endpoint . ‘_endpoint’, ‘my_endpoint_content’); function my_endpoint_content() { //content goes here echo ‘My content goes here’; } http://hookr.io/actions/woocommerce_account_key_endpoint/ So, putting a few different sources together, to add a new menu item to the Woocommerce My Account dashboard one needs something like: <?php add_filter(‘woocommerce_account_menu_items’, ‘add_my_menu_items’); function add_my_menu_items($items) … Read more

Rewrite Rule for Post Meta

Okay! So I got this working by just changing the rewrite_rule to include the event… function aca_award_cat_rewrite_rule() { add_rewrite_rule( ‘^awards/([^/]*)/award-category/([^/]*)/?’, ‘index.php?competition=$matches[1]&award_category=$matches[2]’, ‘top’ ); }

Query_vars support in Rest API

correct me, if i’m wrong, but query vars are not processed in REST requests. but there is other ways to make this work. not really sure, if this will help with your problem but hopefully it is at least a push in the right direction function so380236_rest_cpt_query($args, $request) { $query_params = $request->get_query_params(); if (!array_key_exists(‘city’, $query_params)) … Read more

How to append a query string to pagination?

Refer this: Paginate Codex I can see that you are using custom query so you put this below and outside the while loop <?php global $wp_query; $big = 999999999; // need an unlikely integer $args = array( ‘base’ => str_replace( $big, ‘%#%’, esc_url( get_pagenum_link( $big ) ) ), ‘format’ => ‘?page=%#%’, ‘total’ => $wp_query->max_num_pages, ‘current’ … Read more

Code syntax error, “userfullName undefined”

You are missing the ‘echo’ userfullName = <?php $current_user->display_name;?> should be var userfullName = “<?php echo $current_user->display_name;?>” AND notice that I put quotes around that too. BUT!!!! You should really look at using wp_localize_script for declaring javascript variables. Example: add_action(‘wp_enqueue_scripts’, ‘fobu_front_scripts’); function fobu_front_scripts() { global $blog_id; $params = array( ‘site_url’ => site_url(), ‘blog_id’ => $blog_id … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)