Support

Account

Home Forums Backend Issues (wp-admin) ReferenceError: wp is not defined in input.min.js Reply To: ReferenceError: wp is not defined in input.min.js

  • to be clear, I get this message when I try to upload an image to the following form:

    <?php
    /**
     * The main template file.
     *
     * @package Backyard Cures
     */
    ?>
    
    <?php acf_form_head(); ?>
    <?php get_header(); ?>
    
    <div id="submit-cure-all-content" class="all-content">
    <div id="submit-cure-form-content-container" class="all-content-container">
    
    	<div id="primary">
    		<div id="content" role="main">
    
    			<?php /* The loop */ ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    
    				<?php acf_form(array(
    					'post_id'	=> 'new',
    					'field_groups'	=> array( 66 ),
    					'submit_value'	=> 'Publish Your Cure!',
    					'id' => 'byc'
    				)); ?>
    
    			<?php endwhile; ?>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
    	
    </div>
    </div>
    </body>
    </html>

    Here is the code from my functions.php file for good measure:

    function my_pre_save_post( $post_id ) {
        
        // check if this is to be a new post
        if( $post_id != 'new' )
        {
            return $post_id;
        }    
        
    if ($_POST['id'] == 'byc') {	
        // Create a new post
        
        $post = array(
            'post_status'  => 'draft',
            'post_title'  => $_POST['fields']['field_53f3c10f19d51'],
            'post_type'  => 'byc_cure',
        );
    
        // insert the post
        $post_id = wp_insert_post( $post );
    
        // update $_POST['return']
        $_POST['return'] = add_query_arg( array('post_id' => $post_id), $_POST['return'] );
    	
    	
        // return the new ID
        return $post_id;
    }
    }
    add_filter('acf/pre_save_post' , 'my_pre_save_post' );