How use wp_insert_post and add og:custom tags?

You can add it this way, you send the tags separated by commas. // text add $my_post = array(); $my_post[‘post_title’] = ‘title’; $my_post[‘post_content’] = ‘text.’; $my_post[‘post_status’] = ‘publish’; $my_post[‘post_author’] = 1; $my_post[‘post_category’] = array(8,39); //database add wp_insert_post( $my_post );

How to display acf field values from home page on all pages?

ACF’s the_field() and get_field() accept several parameters, one of which is a post ID. So, you just need to get the ID of the page the field is on, like this: <?php $frontpage_id = get_option( ‘page_on_front’ ); the_field(‘contact_form_title’, $frontpage_id); // For pages other than home $page = get_page_by_path(‘some-page-slug’); the_field(‘contact_form_title’, $page->ID); ?>

Apply function.php filter only if url not has /amp/

What is amp? Is it tag or category or page? You should use standard wordpress functions like is_page() is_category() is_tag(). You can also use $wp->request. It will return the request URI. If the address is “http://example.com/slug1/slug2” it will return slug1/slug2 then use explode() function to split it. <?php $uri = $wp->request; $slugs = explode(“/”,$uri);//variable $slugs … Read more