get second ID from array

Your function is called “replace_thumbnail” so I am assuming you are trying to set/replace the post thumbnail (featured image): function replace_thumbnail($id) { $image_ids = array(); $media = get_attached_media( ‘image’, $id );; foreach($media as $item) { $image_ids[] = $item->ID; } // insert your featured image if (!empty($image_ids[1])) { update_post_meta( $id, ‘_thumbnail_id’, $image_ids[1] ); } // $image_ids_str … Read more

PHP – Multiple variables in insert post array

$post_id = wp_insert_post( array( ‘comment_status’ => ‘open’, ‘ping_status’ => ‘closed’, ‘post_author’ => $current_user->ID, ‘post_name’ => $slug, ‘post_title’ => $pollq_question, ‘post_status’ => ‘publish’, ‘post_type’ => ‘post’, ‘post_content’ => $_POST[‘poll-description’] . ‘[poll id=’ . $latest_pollid . ‘]’ ) );

seo meta description issue in google search

An easier way to check what is happening is to check the source code of your pages where the meta description is added through Yoast <meta name=”description” <meta property=”og:description” content=” Check what the above values say and if there is any conflict. If the text in the above meta fields are not as entered through … Read more

if is specific custom post in cpt

I don’t think that is possible using some function (I can be completely wrong though). What you can do is check page slug using if() statement. Something like: global $post; $post_slug=$post->post_name; if($post_slug==’harry-potter’){ //something here }

How to pass parameter to another url?

Use a query string when you link to job-description.php, so you’d have links like this: job-description.php?job_id=1 job-description.php?job_id=2 job-description.php?job_id=3 etc. In job-description.php, then you can use $_GET to get the job_id. Make sure to sanitize it since it’s in the URL and could be changed by a devious person. I’d get the value for job_id and … Read more