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

retrieve the oldest post id

I do not see any problem in your query (except some poor query writing styles). You did not explain ‘does not work’. what you get in return? do you get any errors? Probably you do not have any published job_listing! However, here is how you can improve your given code: $oldest_post_id = $wpdb->get_row(“SELECT `id` FROM … Read more

Why does the page/post ID keep growing when i refresh the post-new.php file?

This is normal behaviour, as I understand it. When you load the page post-new.php, you run this function: $post = get_default_post_to_edit( $post_type, true ); where the second argument stands for $create_in_db. If true then this part is executed: if ( $create_in_db ) { $post_id = wp_insert_post(…); } inside get_default_post_to_edit().

Categories id Tags

Help getting previously visited pages ID

get_page_by_path() should help you here. Something like this <php $prev_url = isset($_SERVER[‘HTTP_REFERER’]) ? $_SERVER[‘HTTP_REFERER’] : ”; if ( $prev_url ) { $prev_path = str_replace( home_url(), ”, $prev_url ); $page = get_page_by_path( $prev_path ); } That should give you the page object, where you can access it’s ID like so – $page->ID.

Set post tags using tag ID

For non-hierarchical terms (such as tags), you can pass either the term name or id. If you pass the id there is only one caveat: You must pass it as an integer, and it must be in an array. This is necessary because any non-array value passed will be converted to a string, which will … Read more

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