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

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

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

You have found a bug in Genesis. Your Xdebug stack trace fingers the culprit as the genesis_save_custom_fields() function which calls current_user_can() with a singular capability (edit_post and edit_page) which also requires an additional argument, in this case the post ID which is missing. current_user_can() calls has_cap() which calls map_meta_cap() ...


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 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

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

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

"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 ...


3

Your issue is in the callable object you add: array( __CLASS__, "build_shortcode") This translates to: array( "WC_Product_Categories", "build_shortcode") Which is equivalent to: WC_Product_Categories::build_shortcode(); But build_shortcode is not a static function/method, and static functions/methods do not have a $this object, because there is no ...


3

You'll need to log onto your FTP server and goto the wp-content folder -> plugins -> and delete the GZIP plugin you have installed. If you are not sure about FTP, you can probably try and go through your web server control panel, they usually have some sort of file browsing option. You might also need to check the .htaccess file also, but just try removing ...


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

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

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.


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

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

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

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 had the same problem but it occured while importing the theme-unit-test-data.xml along with its attachments. I am using WP 3.8.1. It's a WordPress issue so editing the php.ini has no effect. WP uses a hardcoded value (60 secs) for http_request_timeout of WP_Http in class-http.php. To solve it, place this code in functions.php of your currently active ...


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 ...


2

You need to escape your quotes, or use doubles, or use heredoc: // Escaped return '<div id="xxxx-xxxxxx"></div> <script type="text/javascript"> window._taboola = window._taboola || []; _taboola.push({ mode: \'xxxxxxx-xxxxx\', container: \'xxxxxx-xxxxxxx\', placement: \'one word word\', target_type: ...


2

the_title() calls your function again. If you want to avoid that, remove the callback inside of your function: function filter_title_after() { remove_filter( current_filter(), __FUNCTION__ ); // the rest of your code. But you shouldn’t call the_title() in your function at all: it prints the title – this is not what you want – and you get the ...


2

Apparently, for the PHP code to run (with the WordPress functions), you have to use AJAX differently First, you need to add wp_localize_script() to add data to the script. I used the following code: // For AJAX loading of sections wp_localize_script('customizer', 'ajax', array( 'url' => admin_url('admin-ajax.php') )); Where customizer is the ...


1

Your function must return the variable $errors – even when there is no new error in your logic. 'registration_errors' is a filter, and filters always expect a return value. Without that your function returns NULL, and that is what var_dump() found. So the basic function body should be: function add_user_to_SF($errors, $sanitized_user_login, $user_email ) ...


1

About the Error Exception thrown without a stack frame Means that someone's code threw and exception in a place where it wasn't allowed to throw an exception. For instance, one cannot throw an exception in an object's destructor. There's a fairly good example of how this might happen in the php docs. In short, if you have an exception handler ...


1

How to do remote requests in WordPress: Use the appropriate API First, there's the WP HTTP API, which should be used for such tasks. And second, one should never ever use the @ operator, as this one suppresses error messages or notices and will successfully lock you out from troubleshooting your bugs. Just because you can't see it, doesn't mean that it's ...


1

Unfortunately, it looks like the WordPress update failed. The good news is that it's an easy fix. Simply download the files and re-upload them. You can follow the instructions here: http://codex.wordpress.org/Updating_WordPress#Manual_Update



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