Using wp_insert_post to create custom posts with ACF image field

ACF has documentation for creating a form on the frontend. I would stick to their suggestions. https://www.advancedcustomfields.com/resources/create-a-front-end-form/ I was able to create this by assigning my field group for the form to the custom post type and using a unique template page for the form. <?php /** * Template Name: Form Page Template */ ?> … Read more

is therer any wordpress function to retrieve a specific html element from post content

You can try extracting the content of the first H1 tag from your post. function get_first_h1(){ //Get filtered content of post ob_start(); the_content(); $content = ob_get_clean(); //Define matching pattern: content of h1 tags $h1_pattern = “~<h1>(.*)</h1>~”; //Variable to hold results $header_matches = array(); //Search content for pattern preg_match( $h1_pattern, $content, $header_matches ); //First match will … Read more

Show custom category archive as front page and remove taxonomy slug from urls

I was able to solve this by removing CPT UI plugin, registering the custom post type with: function create_post_type() { $args = array ( ‘public’ => true, ‘has_archive’ => true, ‘show_ui’ => true, ‘supports’ => array(‘revision’,’title’,’editor’,’author’, ‘thumbnail’, ‘custom-fields’), ‘taxonomies’ => array( ‘category’ ), ‘labels’ => array( ‘name’ => __( ‘work’ ), ‘singular_name’ => __( ‘work’ … Read more