Tag Info

Hot answers tagged

6

You are calling the function too early. The functions.php is included before current_user_can() is defined. Never do anything before the hook 'after_setup_theme': Example for the functions.php add_action( 'after_setup_theme', array( 'WPSE_14041_Base', 'setup' ) ); class WPSE_14041_Base { public static function setup() { ! isset ( ...


5

The only way that function returns an instance of WP_Error is if $cat (in your example) has an empty value. You need to check the return before doing anything with it. Replacing that line with this should fix the problem: echo is_wp_error( $cat_parents = get_category_parents($cat, TRUE, '' . $delimiter . '') ) ? '' : $cat_parents;


4

In almost all cases you can simply delete the plugin and it will be switched off automatically, and in fact that is advice I've given many times to help reel in broken sites. The same is true for themes. Some plugins are actually more complicated than that and require additional steps. Notably, the caching plugins tend to fall into that category as some add ...


3

There is no reference to 'classes.php' anywhere in the WP codebase, either in the 3.1 branch or in trunk. You probably have a modified version. Do a 'svn stat' and then a 'svn diff'.


3

The Health Check plugin is triggering the first error. Is this when you're running 2.7? get_transient() was only introduced in 2.8, which would explain it's absence. The second failure is merely a failed HTTP request. This can happen every now and then (mainly due to timeouts). It shouldn't interrupt the normal functioning of WordPress (the HTTP request was ...


3

Why exactly are you trying to redeclare that function? You can either edit the original function, or, better yet, use remove_action to remove add_action( 'widgets_init', 'twentyeleven_widgets_init' ); and then reattach your own function add_action('widgets_init', 'your_widgets_init_function' );


3

wp_mail() is defined in wp-includes/pluggable.php. This file is loaded after the plugins are loaded, but before the hook plugins_loaded has been fired. So the answer is: wait. add_action( 'plugins_loaded', 'renderHTML' ); On a side note: prefix your function names and your global variables.


3

Don't mess around with changing those files directly. It will break when that file gets changed in an update. Do this instead. add_filter( 'wp_mail_from', 'override_mail_from_address' ); add_filter( 'wp_mail_from_name', 'override_mail_from_name' ); function override_mail_from_address($email_address) { $from_array = explode('@', $email_address); ...


3

You're getting the error because the Facebook and All In One Event Calendar plugins are both declaring the fb_admin_dialog() function, but PHP only allows a function to be declared once. To fix the immediate problem, log in to your server with S/FTP and rename the wp-content/plugins/all-in-one-event-calendar directory to something like ...


3

"the errors (…) don't show a stack trace" - they would if you were using xdebug. It means $wpdb is not loaded yet, not loaded properly, or gone: If you added code that calls it to your wp-config file or something to that order, remove it. If you've a db.php file in wp-content, it's probably broken so rename it. If you're messing around with things on a ...


2

This issue usually stems from PHP configuration issues, APC caching, and/or a call to an incompatible XML library. From what I've seen, it is usually a combination of php 5.2.X and caching. If you're using caching on your site, try switching from APC/memcached cache to disk caching and see if it clears up. 9/10 times, disabling APC at the server level ...


2

You failed to update the files in the root of WordPress. I don't know why, but a lot of people make this simple mistake. It is not enough to upgrade only the wp-admin and wp-includes directories. The files in the root directory, such as wp-settings.php and all the other wp-* files there, also must be upgraded. WordPress 3.1 no longer contains a ...


2

Ok, solved my own issue... This might be very specific, but in case anyone ever finds a similar issue: to catch unexpected output errors I had another function: add_action('activated_plugin','save_error'); function save_error(){ $file = "unexpected-output.txt"; $fh = fopen($file, 'w') or die("can't open file"); $error = ob_get_contents(); ...


2

I'm gonna add this as an answer, though it's probably not the answer you want. The answer is "No, it is not possible". Out of memory errors in PHP are fatal errors. There is no recovering from a fatality, and so no way to return a useful error message.


2

wp() is quite essential function. It resides in functions.php file (don't confuse with functions.php in theme, different thing) and I don't think you can load WP without passing require directive for that file at some point. So your install seems very broken - either functions.php file in core is damaged or something else is broken and makes it skip loading ...


2

Fatal errors point to bad syntax, or bad naming conventions. WordPress does a good job of not activating plugins that throw fatal errors. However, once a plugin is activated, all bets are off. If you've created a function or a class, it's best to follow good naming conventions and namespace properly. For example, a function called post_extras() would not be ...


2

get_current_screen() is a backend function and it returns data about the current backend administration page. It makes no sense to use this in theme code. The only way it would work (I think but haven't tested) in functions.php would be if it were hooked into a backend hook later than admin_init. You don't explain what you are trying to do with ...


1

Do a complete update of WordPress, including all the files. The function named "reset_mbstring_encoding" is in the wp-includes/functions.php file and has been since 3.7, so if you're missing it or some other file, then you need to make sure all the WordPress files are up-to-date.


1

Hey I found the answer in this forum https://wordpress.org/support/topic/fatal-error-cannot-call-overloaded-function-for-non-object-1/page/2?replies=35#post-6035835. "Just wanted to share how I fix the issue. In the cpanel control panel, choose "Select PHP version". Then I select "PHP Version 5.5". Then click save." Worked for me. It seems like it's a ...


1

From the error you posted, I suspect that there was some kind of file corruption. The original file /wp-includes/post.php shouldn't end at line 235. The file should have 5841 lines (in WP version 4.0 and 4.0.1). If it was a file corruption and the error doesn't appear anymore, the update probably "healed" the damage by overwriting the file. Nevertheless I ...


1

You can try to use functions.php to handle the form submission and send the data via AJAX. Add a hidden field in your form with the action to be taken (on functions.php): <input type="hidden" name="action" value="save_contact"/> In you footer.php add the jQuery code to handle the AJAX request: jQuery('#your-form').submit(ajaxSubmit); function ...


1

The CSS for my parent theme (core) was incorrectly formatted. The code at the top read: Theme Name: Core Theme URI: http://www.domain.co.uk Description: The core theme. Author: Squideyes Author URI: http://www.domain.co.uk Template: Core Version: 1.0.0 Tags: clean, simple, easy The Template: tag should only appear in the child theme css. This is what ...


1

To diagnose a load-intensive (either CPU cycles or memory) Plugin, start by deactivating all Plugins. Ensure that, with no Plugins active, you do not observe the same issues. If you observe the same issues with all Plugins deactivated, then the problem is somewhere else, either with your Theme, your database, or your server configuration. If you don't ...


1

The error indicates that your file "floater.php" is being called outside of a WordPress generated page. Add this to the top of the file to be able to use WordPress functions. EDIT: See Brian Fegter response on using the server path for your include. if ( !function_exists( 'get_bloginfo' ) ) require( '../../../wp-blog-header.php' ); // check path leads ...


1

You should include using the server path rather than the URL. This will give you access to WordPress functionality. include('extras/floater.php'); Update: The following is to further explain why it's a bad practice to include the file via URL. Here's what's happening: There is an innate inheritance when you include a file via server path. It has access ...


1

I faced with the same issue when I was writing my backup plugin. The bug appear when you fetch all data from db by calling $wpdb->get_results( ... ). And as you can suppose it fetch all data into memory allocated for php. The better approach is to use mysql_* functions to fetch row one by one and store data into temporary file. This approach will reduce ...


1

I'm not sure where you're getting those stats, but I doubt that is showing you the amount of memory being used while processing the images. If you navigate to some memory use screen, you're seeing the amount of memory currently allocated, which is now an entirely different process from when you were uploading images. The fact that Out of memory (allocated ...


1

There really is nothing anyone here can do for you with such limited information. It is obviously something within your recent changes. If you use a version control system (as everybody really should), I would roll back the changes and then from there slowly re-implement the changes that were causing this error to track it down and get rid of it.


1

It's WordPress 3.1 function - so you're probably testing it on older versions.


1

To load WordPress it is enough to load "wp-load.php" like you did. I don't recognize the wp() function and haven't found it in the source. As other people seem to have the same problem on the internet I guess it has to do with a plugin or a possibly outdated WordPress installation. Disable all your plugins and see if that resolves the problem. Out of ...



Only top voted, non community-wiki answers of a minimum length are eligible