Category Archives: WordPress

Calling wp_insert_post to create a post with assigned ID in WordPress

Regarding ‘wp_insert_post’ function, you may want to insert posts with assigned IDs for some reason. Yes, you can do it by using $post->import_id. There is also $post->ID parameter to determine ID. I’ll describe difference between $post->import_id and $post->ID of wp_insert_post. If you want to insert a new post with arbitrary ID, use $post->import_id. If you … Continue reading Calling wp_insert_post to create a post with assigned ID in WordPress

Modifying HTTP response header in your WordPress site

Though Google recommends responsive web design most, they also support sites which produce different HTML on the same URL depending on user-agent information. My site is the latter. Google’s recommendation to sites like mine is to use ‘Vary’ HTTP header. But with standard installation, WordPress doesn’t set ‘Vary’ HTTP field in HTTP response header. So … Continue reading Modifying HTTP response header in your WordPress site