get term id from term name

Try to use get_term_by(), where first argument is a field, in your case – name. Second is your value. I used esc_attr() to make it secure. Third one is taxonomy, as example I put here category. if ($_SERVER[“REQUEST_METHOD”] == “GET” && $_GET[‘fname2’] && $_GET[‘fname’]) { $nameb = get_term_by(‘name’, esc_attr($_GET[‘fname2’]), ‘category’); $namea = get_term_by(‘name’, esc_attr($_GET[‘fname’]), ‘category’); … Read more

How is $current_page passed in woocommerce_account_orders function?

Action hooks can pass variables do hooked callback functions. For example: do_action( ‘my_custom_action’, $a_variable ); For that action, any callback function has access to $a_variable: add_action( ‘my_custom_action’, ‘my_custom_function’ ); function my_custom_function( $a_variable ) { // etc. } The woocommerce_account_orders_endpoint action hook is defined like this: do_action( ‘woocommerce_account_’ . $key . ‘_endpoint’, $value ); Where $value … Read more

Query within a foreach within a query (queryception)

Good for you that you’ve corrected the $posts that was undefined, but then: There’s no need to call $the_query->get_posts() because when WP_Query is instantiated with a non-empty query, e.g. new WP_Query( ‘post_type=house’ ) (contains one query arg — post_type) as opposed to new WP_Query() (no query args specified), the get_posts() method in that class will … Read more

search blog posts by author first name and or last name

Actually, when you set author_name, WP_Query will use get_user_by( ‘slug’, <author name> ) to find a user with the specified “nice name” (user_nicename) value, and if found, then WP_Query sets the author arg to the found user’s ID. Therefore you can follow the same approach, but you would use get_users() to find users having the … Read more