I've been having a problem with my media browser for weeks and haven't been able to solve it. When browsing to insert an image, the media library shows absolutely nothing, just blank white. I see tabs telling me that it sees the objects in the library, but they do not display as thumbnails to select.
For some reason it just occurred to me (a-doy) to look at my server logs - turns out my ISP has been suppressing PHP errors. The error I'm getting is this:
PHP Fatal error: Call to undefined
function get_post_thumbnail_id() in
REDACTED/wp-admin/includes/media.php
on line 1292, referer:
http://REDACTED/wp-admin/media-upload.php?post_id=877&type=image&
Now this is baffling - I did a completely fresh install of WordPress to try and solve this problem, and yet I'm still getting an "undefined function" error. Why is this happening, and how can I fix it?
Any help is greatly appreciated. Thank you!
It looks as if you have to initialize theme support before get_post_thumbnail_id() can be used.
<?php add_theme_support('post-thumbnails'); ?>
http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
Make sure that your add_theme_support('post-thumbnails') function is run before init. I know this has screwed me up when I had it in a hook tied into init.
If it has to be hooked in, it should be hooked into after_setup_theme
Related
My site is currently on PHP 7.2.0, and I'm getting this error in my debug log showing PHP Deprecated: Function create_function() is deprecated
I don't know what happened but my site somehow became broken and stuff wasn't showing properly. The only way I can access my wordpress dashboard is when I force the site to load on a default theme.
So I guess the problem lies within my Theme...
Right now, the site doesn't load up at all and it's showing a blank white screen or saying that The site is experiencing technical difficulties.
I'm still a new web developer... Any idea what could have gone wrong and how to fix my current code that is showing the error?
add_action('widgets_init', create_function('', 'return register_widget("Essential_Grids_Widget");'));
Thanks for your help!
use it like this
$MywidgetName='Essential_Grids_Widget';
add_action('widgets_init', function () use ($MywidgetName) {
return register_widget($MywidgetName);
});
I am getting this error:
Uncaught TypeError: wp.template is not a function on template for Algolia. It is clearly associated with the widget that calls the hits:
search.addWidget(
instantsearch.widgets.hits({
container: '#hits',
hitsPerPage: 30,
templates: {
item: wp.template('instantsearch-hit'),
empty: "We didn't find any results for the search <em>\"{{query}}\"</em>"
}
})
);
From what I already know this needs wp-util.js script to work (this is supposed to be part of WordPress and this script can be found:
/wp-includes/js/wp-util.js
More about it here:
https://codex.wordpress.org/Javascript_Reference/wp.template
It seems the issue is that the template is not loading for some reason. I tried to enqueue the script via functions.php, but after doing so apart from getting previous error I get two new errors:
Uncaught ReferenceError: _ is not defined
at wp-util.js:17
at wp-util.js:124
Did anyone had such issue and managed to resolve it already?
Thank you for your help.
Are you using Cloudflare rocket loader by any chance?
There is a bug report for the same error that is apparently caused by Cloudflare rocket loader.
The solution mentioned in that bug report is:
I applied a small workaround to prevent the js error, which was
blocking other scripts in my website, adding:
if( wp.template == null ) return;
right after the firing of the script:
jQuery(function () {
In this way, my following scripts are fired correctly, but sometimes
(let's say 1 time every 4 page loads) the autocomplete search is not
fired.
Faced same issue in my wp's admin panel. And found that "BackUpWordpress" plugin was the problem. I just deactivate it and checked page again. Error was gone.
So the solution is just deactivate additional plugins one by one and check errored page every time. This is how you can have the idea which plugin is responsible for this jquery error.
I confirmed that to deactivate plugin will not erase saved data inside that plugins. So there is no issue to deactivate plugin. Once your work complete on the page where "Uncaught TypeError: wp.template is not a function" error occurred, you can activate plugins again.
In my case I had W3 Total Cache plugin installed, and Minify option was set to Manual.
After I removed wp-underscore script from manual minify list, issue with the wp.template() Not a function was gone.
I am getting this no script error, and am unsure as to why.
Javascript is allowed in my browser, and the adblock is disabled. I see Ninja Forms 3.0.11 has a JS directory with several files.
<noscript class="ninja-forms-noscript-message">
Notice: JavaScript is required for this content.</noscript>
Has anyone come across this upgrading? If so, could you please explain how you resolved this?
Thank you.
I was having this same problem today so I decided to switch themes and see if that fixed it. And that did fix the problem. So I switched back and it was still broken. I inspected the page and noticed there was a JS error in the console and I resolved that JS error that had nothing to do with Ninja Forms and it made my form show up and work fine now. So it seems if there are any JS errors going on it will affect it.
Make sure all of the scripts from your header and footers are getting added to the page correctly. I experienced this issue with an add on for ninja forms and my call to get_footer wasn't being included on the page and created this issue.
i got same error:
Notice: JavaScript is required for this content.
i removed my cache plugin Autoptimize, SG optimizer, the plugin used to combine js/css files etc,
it will solve your problem :)
Thank You
Мy decision: add code <? php wp_footer (); ?> in the template file footer.php
I've put about 4 hours into trying to solve this issue. Please Help!
I've been working on developing my first custom plugin. Everything was going well until I started references files in subdirectories in my plugin. Here's the complete error I'm seeing every time I activate the plugin:
"The plugin generated 1521 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin."
My plugin file hierarchy is as follows:
Main File: wp-content/plugins/myplugin/index.php
Database Building File: wp-content/plugins/myplugins/DB/initialize.php
In my index.php file, I'm calling the initialize.php file using the register_activation_hook function.here's the whole code:
add_action('admin_menu', 'form_forge_options');
include_once dirname(__FILE__) . '/DB/initialize_database.php';
register_activation_hook(__FILE__ , 'bbp_g_init_database');
I've often found that the cause of this error is whitespace (or anything else) before the opening tag.
Use after the plugin(means at start) header ob_start();
i hope will help you:>
I've often found that the cause of this error is whitespace (or anything else) before the opening <?php tag or after the closing ?> tag. You can leave the closing tag off to avoid the latter issue.
However, after looking around on Google, it appears there are other possible reasons for this error message, and even a plugin that will help you debug this specific issue: Debug Plugin Activation Errors
So this problem is very strange because for me doesn't work Wordpress media library in Wordpress admin menu only grid mode, its very strange problem because this problem occurs ONLY on 1 account/ That would be same account that yesterday i was trying upload bunch of pictures to media library and it gave error:
Try again later...
Since that i have tried many things but besides logging with other account nothing helped.
Tried reninstall wordpress via wordpress admin panel
Tried disabling all plugins, changed theme to default wordpress
Tried inspect elemet for JS errors nothing there except
upload.php?mode=grid:46 Consider using 'dppx' units, as in CSS 'dpi'
means dots-per-CSS-inch, not dots-per-physical-inch, so does not
correspond to the actual 'dpi' of a screen. In media query expression:
print, not all, (-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 120dpi)
Tried include in theme functions bunch of codes that i found on internet didn't helped.(i don't have them now since nothing helped and i didn't saved them sorry...)
Tried flushing cache, proxy, different computers, different operating systems(max,windows), tablet nothing still on that particular account media grid view doesn't work
View that 'm seeing is this:
I don't understand whats wrong, why on 1 particular account it doesn't work i even tried flushing Wordpress cache but it doesn't work after i received that error which i showed above. Did somebody know how can i solve this? Thanks in advance!
Got exactly the same problem and some ajax error on revolution slider too, and after searching for long time i resolved my problem.
It was just an HTML comment in functions.php on child theme, after remove it, everything work perfectly for me.
Same problem with space in function.php don't cut your code with space between php tag
this type problem is create by functions.php file , remove the code of you added in functions.php and than see it work proper.
standerd code write in functions.php file
In my case, there was an error in the backend. You should check your network tab in developer tools and find admin-ajax.php. Even if it returns HTTP 200, it shows an error in the response body.
From the information provided, you can work on which plugin, theme, or whatever file causes the error.
If the problem is with the user and seeing that you have tried almost all, you can try deleting the user and creating it again.
I had exactly the same error. I could not search for plugins, get the list of my uploads, everywhere where an ajax function was triggered, I needed to reload the page to see the results.
clean your functions.php and see if it works now. if yes, clean up your functions.php search for spaces or not set closing tags.
Solution was simple – I just had accidentally added a closing php tag in my functions.php (?>).
After I removed it the problem was solved.