Support

Account

Home Forums Bug Reports Post Object: Loading Failed

Solved

Post Object: Loading Failed

  • I am using VideoJS plugin, Yoast SEO and ACF 5.3.2.2.

    I set a custom type called: Video, and set a field to be “Post Object”.

    When I go back and search a custom post, it shows “Loading Failed”.

    After digging in the code, it seems that the JSON is not loaded properly, as a result the search cannot be done.

    Below is the exact code generated.

    Can you please take a look and see if it can be fixed?

    Thank you very much for your help.

    <script type="text/javascript">
    /* <![CDATA[ */
    if( typeof acf !== 'undefined' ) {
    
    	acf.o = {"post_id":1525,"nonce":"617affe84c","admin_url":"http:\/\/localhost\/unicef\/wp-admin\/","ajaxurl":"http:\/\/localhost\/unicef\/wp-admin\/admin-ajax.php","ajax":1,"validation":1,"wp_version":"4.3.1"};
    	acf.l10n = {"unload":"The changes you made will be lost if you navigate away from this page","expand_details":"Expand Details","collapse_details":"Collapse Details","validation_successful":"Validation successful","validation_failed":"Validation failed","validation_failed_1":"1 field requires attention","validation_failed_2":"%d fields require attention","restricted":"Restricted","image":{"select":"Select Image","edit":"Edit Image","update":"Update Image","uploadedTo":"Uploaded to this post","all":"All images"},"file":{"select":"Select File","edit":"Edit File","update":"Update File","uploadedTo":"uploaded to this post"},"relationship":{"min":"Minimum values reached ( {min} values )","max":"Maximum values reached ( {max} values )","loading":"Loading","empty":"No matches found"},"google_map":{"locating":"Locating","browser_support":"Sorry, this browser does not support geolocation"},"date_picker":{"closeText":"Done","currentText":"Today","monthNames":["January","February","March","April","May","June","July","August","September","October","November","December"],"monthNamesShort":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"monthStatus":"Show a different month","dayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"dayNamesShort":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"dayNamesMin":["S","M","T","W","T","F","S"],"isRTL":false},"repeater":{"min":"Minimum rows reached ({min} rows)","max":"Maximum rows reached ({max} rows)"},"flexible_content":{"layout":"layout","layouts":"layouts","remove":"remove {layout}?","min":"This field requires at least {min} {identifier}","max":"This field has a limit of {max} {identifier}","min_layout":"This field requires at least {min} {label} {identifier}","max_layout":"Maximum {label} limit reached ({max} {identifier})","available":"{available} {label} {identifier} available (max {max})","required":"{required} {label} {identifier} required (min {min})"},"gallery":{"select":"Add Image to Gallery","edit":"Edit Image","update":"Update Image","uploadedTo":"uploaded to this post","max":"Maximum selection reached"}};
    	acf.media.mime_types = {"jpg|jpeg|jpe":"image\/jpeg","gif":"image\/gif","png":"image\/png","bmp":"image\/bmp","tiff|tif":"image\/tiff","ico":"image\/x-icon","asf|asx":"video\/x-ms-asf","wmv":"video\/x-ms-wmv","wmx":"video\/x-ms-wmx","wm":"video\/x-ms-wm","avi":"video\/avi","divx":"video\/divx","flv":"video\/x-flv","mov|qt":"video\/quicktime","mpeg|mpg|mpe":"video\/mpeg","mp4|m4v":"video\/mp4","ogv":"video\/ogg","webm":"video\/webm","mkv":"video\/x-matroska","3gp|3gpp":"video\/3gpp","3g2|3gp2":"video\/3gpp2","txt|asc|c|cc|h|srt":"text\/plain","csv":"text\/csv","tsv":"text\/tab-separated-values","ics":"text\/calendar","rtx":"text\/richtext","css":"text\/css","htm|html":"text\/html","vtt":"text\/vtt","dfxp":"application\/ttaf+xml","mp3|m4a|m4b":"audio\/mpeg","ra|ram":"audio\/x-realaudio","wav":"audio\/wav","ogg|oga":"audio\/ogg","mid|midi":"audio\/midi","wma":"audio\/x-ms-wma","wax":"audio\/x-ms-wax","mka":"audio\/x-matroska","rtf":"application\/rtf","js":"application\/javascript","pdf":"application\/pdf","class":"application\/java","tar":"application\/x-tar","zip":"application\/zip","gz|gzip":"application\/x-gzip","rar":"application\/rar","7z":"application\/x-7z-compressed","psd":"application\/octet-stream","xcf":"application\/octet-stream","doc":"application\/msword","pot|pps|ppt":"application\/vnd.ms-powerpoint","wri":"application\/vnd.ms-write","xla|xls|xlt|xlw":"application\/vnd.ms-excel","mdb":"application\/vnd.ms-access","mpp":"application\/vnd.ms-project","docx":"application\/vnd.openxmlformats-officedocument.wordprocessingml.document","docm":"application\/vnd.ms-word.document.macroEnabled.12","dotx":"application\/vnd.openxmlformats-officedocument.wordprocessingml.template","dotm":"application\/vnd.ms-word.template.macroEnabled.12","xlsx":"application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet","xlsm":"application\/vnd.ms-excel.sheet.macroEnabled.12","xlsb":"application\/vnd.ms-excel.sheet.binary.macroEnabled.12","xltx":"application\/vnd.openxmlformats-officedocument.spreadsheetml.template","xltm":"application\/vnd.ms-excel.template.macroEnabled.12","xlam":"application\/vnd.ms-excel.addin.macroEnabled.12","pptx":"application\/vnd.openxmlformats-officedocument.presentationml.presentation","pptm":"application\/vnd.ms-powerpoint.presentation.macroEnabled.12","ppsx":"application\/vnd.openxmlformats-officedocument.presentationml.slideshow","ppsm":"application\/vnd.ms-powerpoint.slideshow.macroEnabled.12","potx":"application\/vnd.openxmlformats-officedocument.presentationml.template","potm":"application\/vnd.ms-powerpoint.template.macroEnabled.12","ppam":"application\/vnd.ms-powerpoint.addin.macroEnabled.12","sldx":"application\/vnd.openxmlformats-officedocument.presentationml.slide","sldm":"application\/vnd.ms-powerpoint.slide.macroEnabled.12","onetoc|onetoc2|onetmp|onepkg":"application\/onenote","oxps":"application\/oxps","xps":"application\/vnd.ms-xpsdocument","odt":"application\/vnd.oasis.opendocument.text","odp":"application\/vnd.oasis.opendocument.presentation","ods":"application\/vnd.oasis.opendocument.spreadsheet","odg":"application\/vnd.oasis.opendocument.graphics","odc":"application\/vnd.oasis.opendocument.chart","odb":"application\/vnd.oasis.opendocument.database","odf":"application\/vnd.oasis.opendocument.formula","wp|wpd":"application\/wordperfect","key":"application\/vnd.apple.keynote","numbers":"application\/vnd.apple.numbers","pages":"application\/vnd.apple.pages"};
    	<div style="display:none"><input type="hidden" id="videojs-autoplay-default" value=""><input type="hidden" id="videojs-preload-default" value=""></div>acf.fields.wysiwyg.toolbars = {"full":{"1":"bold,italic,strikethrough,bullist,numlist,blockquote,hr,alignleft,aligncenter,alignright,link,unlink,wp_more,spellchecker,fullscreen,wp_adv,|,videojs,|,wpsrbutton","2":"formatselect,underline,alignjustify,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help","3":"","4":""},"basic":{"1":"bold,italic,underline,blockquote,strikethrough,bullist,numlist,alignleft,aligncenter,alignright,undo,redo,link,unlink,fullscreen"}};
    		
    	acf.do_action('prepare');
    	
    }
    /* ]]> */
    </script>
  • What version of ACF are you using?

    Do you have this problem with the videoJS plugin deactivated?

    The reason I ask the second question is that in the code you posted, this part looks like it’s being generated by that plugin and I think it’s the cause of the error

    
    <div style="display:none"><input type="hidden" id="videojs-autoplay-default"
    value=""><input type="hidden" id="videojs-preload-default" value=""></div>
    
  • Hi John

    I am using ACF 5.3.2.2.

    And yes, I can have ACF work if videoJS is deactivated.

    However, since videoJS can help me to create a responsive video, and I found that if ACF can fix the problem of this generated JSON string, I don’t need to deactivate this plugin. 😀

    Hope you can understand and thank you for your help.

  • I don’t know this plugin, can you provide a link? I did a search for videoJS and didn’t find anything.

    Honestly, if that plugin is causing the value to output incorrectly then it’s more than likely a problem with that plugin. I might be able to take a quick look at it and I might be able to find where the problem is, but I can’t be sure.

  • Hi John

    Thank you very much. I know that it is not the right way to do so but, here is the plugin page:

    https://wordpress.org/plugins/videojs-html5-video-player-for-wordpress/

    Thank you very much again for your support.

  • There are several problems with that plugin. The first is that it has not been updated in 2 years. The second is on starting on lines 276 to 292 of the file video-js.php. You can see in this code where it’s being output. This should only be outputting JavaScript values, not HTML.

    
    /* TinyMCE Shortcode Generator */
    function video_js_button() {
    	if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
    		return;
    	if ( get_user_option('rich_editing') == 'true' ) {
    		add_filter('mce_external_plugins', 'video_js_mce_plugin');
    		add_filter('mce_buttons', 'register_video_js_button');
    	}
    }
    add_action('init', 'video_js_button');
    
    function register_video_js_button($buttons) {
    	array_push($buttons, "|", "videojs");
    	$options = get_option('videojs_options');
    	echo('<div style="display:none"><input type="hidden" id="videojs-autoplay-default" value="' . $options['videojs_autoplay'] . '"><input type="hidden" id="videojs-preload-default" value="' . $options['videojs_preload'] . '"></div>'); //the default values from the admin screen, to be used by our javascript
    	return $buttons;
    }
    

    You can try commenting out that line, but that will probably break the plugin. If the author of this plugin is no longer supporting it and you can’t get support from there then your best bet would be to find an up to day plugin that will do the job.

  • Noted. Thank you very much John for your kind help.

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Post Object: Loading Failed’ is closed to new replies.