echo esc_url( get_permalink($post->ID) + complete the ID’s url

The best approach, from my point of view, is to use add_query_arg() function: $only_conent_url = add_query_arg( array( ‘content-only’ => 1 ), get_permalink( $post->ID ) ); And then you can escape it if you need: esc_url( $only_conent_url ); add_query_arg() takes the URL passed as second paramenter and append a properly formatted query string built from the … Read more

How to Extend login session times to a Month

By default the login cookie lasts for 14 days if you tick ‘remember me’ 48 hours if you don’t So as a short term fix you probably want to tick ‘remember me’, and to extend that to 30 days you can add an auth_cookie_expiration filter e.g. function auth_cookie_expiration_30_days( $seconds, $user_id, $remember_me ) { if ( … Read more

Use post ID in functions.php file adminside

It depends on, where you are calling these functions. That is the point, where you enter the var into the function. First, remove the global $post from your functions.php! It makes no sense there! In the functions.php you declare the functions, not call them! I assume, you call your function in some template. So the … Read more

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