Support

Account

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

Solved

ReferenceError: wp is not defined in input.min.js

  • Hey guys.

    I’ve just pushed an update to github including (hopefully) a fix for this JS error.

    Can you please pull the latest code from github and test?

    Thanks
    E

  • Hey Elliot,

    We’re experiencing this issue as well on a site we’re developing. The new version on github has resolved the error with the wp object, but the issue still persists. The issue being the fact that no fields are being displayed on the page beneath the field that’s having issues.

    In our case it’s a filter & search field that’s looking through 10k+ posts. It seems like this query is hitting some kind of limit (probably time) that’s causing everything to go downhill from there.

    We’re doing our best to limit the scope of the posts it’s pulling in, but it’s still buggy.

    Let me know if you want access so you can poke around.

  • Hi @MikeNGarrett

    I’m confused.

    This thread is regarding an issue with the JS wp object.
    If this issue has been fixed, can you please let me know and post any ‘other’ issues in a new topic.

    Thanks
    E

  • Hi Elliot,
    Sorry for the confusion. I was trying to say that I think the the wp object error was related to the fact that the field (in our case) never finished processing. I concluded this based on the fact that we were seeing the same result before and after the wp object fix you implemented. Once I limited the scope of the posts that field was trying to query against I wasn’t getting the wp object error and the rest of the edit page was being processed appropriately.

  • Is this still being look into? I have tried updating files from github, but still not working.

    Repeater image upload not working and image upload outside of repeater not working too.

    Looks like

    _media.frame = wp.media( ...

    is the problem? also maybe

    popup()

    too?

  • Hi @busybrian

    On what screen are you using the ACF fields? Is this a normal post edit screen or something else?

    Thanks
    E

  • @elliot — Custom Post Type, WP Multi-site 3.4.1, Windows

    Sorry to be a pain, I know this probably isn’t a bug, but bad code on the website. I have used the same code on other sites and it works fine, but this is the 3rd install I have had this issue with and it’s frustrating troubleshooting it. Is there something I can add to my CPT function to prevent this error. Can I “manually” define wp to prevent it?

  • Hi Gang.

    It mentioned ‘solved’ at the top but we’re still awaiting a fix for this yes?

    Thanks a lot

  • Hi @busybrian

    Perhaps you did not understand my previous question. ACF can be used on many pages such as a post, taxonomy, user, etc.

    On what screen are you using the ACF fields? Is this a normal post edit screen or something else?

  • Hi @buttonmatt

    Sorry this is taking so long, but this thread is a continuous mess of new comments reporting the issue, but not describing any information that could help to track down the problem itself.

    Perhaps you could open up a new thread with a detailed report of the problem and some debugging that you have done to discover where the issue is coming from?

    Thanks
    E

  • Hey Elliot,

    More than happy to provide you access and show where we’re seeing the issue even though it appears we have a work-around.

    [email protected]

  • Elliot,

    I’m having this issue as well. Unable to select an image in a repeater field.

    Feel free to e-mail me and we can fix it up!

  • Hi guys. Just got this error. For me the problem was that I added “<iframe>” in the Field Instructions. Strangely though this worked when I imported the same thing from production and it broke when I saved again on my devbox.

  • Hi, I am getting the same error, here is the console message:

    Uncaught ReferenceError: wp is not defined input.min.js?ver=4.3.8:1
    acf.fields.image.popup input.min.js?ver=4.3.8:1
    (anonymous function) input.min.js?ver=4.3.8:1
    n.event.dispatch jquery.js?ver=1.11.0:3
    r.handle jquery.js?ver=1.11.0:3

    It is pointing me to:

    ... wp.media({states: ...

    in my input.min.js file

  • 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' );
  • To all still wondering…
    If you have field type “relation” that pulls list of all posts in your database and your db contains a lot (!) of posts, that query might time out, so the rest of the page is not rendered properly hence the error occurs.

  • I know this is old but since is still unsolved, and i had the same issue with input.js
    the solution i came up with was force brute radical but it seems to work… i just commented out the part that adds up that file in acf.php

    // register acf scripts
    $scripts = array();
    $scripts[] = array(
    	'handle'	=> 'acf-field-group',
    	'src'		=> $this->settings['dir'] . "js/field-group{$min}.js",
    	'deps'		=> array('jquery')
    );
    // $scripts[] = array(
    // 	'handle'	=> 'acf-input',
    // 	'src'		=> $this->settings['dir'] . "js/input.js",
    // 	'deps'		=> array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker')
    // );
Viewing 17 posts - 51 through 67 (of 67 total)

The topic ‘ReferenceError: wp is not defined in input.min.js’ is closed to new replies.