Hot answers tagged

17

I'm assuming that you put WordPress in your site root and the external directories are also in your site root. The reason this is happening is that .htaccess files follow a hierarchy. Whatever directives are in the top-level .htaccess file flow down and apply to all directories below it. If this is the case, you can do one of several things: Move your ...


14

you can do that using login_errors filter hook and here is how: add_filter('login_errors','login_error_message'); function login_error_message($error){ //check if that's the error you are looking for $pos = strpos($error, 'incorrect'); if (is_int($pos)) { //its the right error so you can overwrite it $error = "Wrong ...


12

I would recommend running the following code right after your query to see what's happening: exit( var_dump( $wpdb->last_query ) ); This should print the last query that hit your database. In cases like these, I usually will manually run such a query through phpMyAdmin to see if it runs without errors and to see if it even affects the database. ...


12

This has worked for me in the past for a similar situation : Put this on top of .htaccess ErrorDocument 401 default


12

First do not use 777, change it back to 755. Second you need to add the proper group permissions most likely to the same that Apache is running under. To find that out try: ps aux | grep apache You will see the Apache user group on the left. Now change your WordPress folder to the same user group, you can do this in a parent folder or sub folder ...


12

Assign return of the function to the variable. Check the variable with is_wp_error(). If true handle accordingly, for example trigger_error() with message from WP_Error->get_error_message() method. If false - proceed as usual. Example from Codex: function doer_of_stuff() { return new WP_Error('broke', __("I've fallen and can't get up")); } $return ...


11

Show errors: $wpdb->show_errors = true shows errors automatically, if WP_DEBUG is set to true. $wpdb->suppress_errors = false stops suppressing errors. Multisite need special treatment // Show errors in Multisite: global $wpdb, $blog_id; // There's no is_multisite(), so we need to check the ID // This means, that we can't debug the blog with the ID ...


11

I get this error when there are no menus defined or no menus set for the location at Appearance->Menus. When that occurs wp_nav_menu uses a page walker fallback. The fallback (default) for wp_nav_menu is wp_walker_page which uses wp_page_menu which uses wp_list_pages which uses walk_page_tree which uses Walker_Page not Walker_Nav_Menu. And apparently ...


10

Hei, first, you check weather your result is a WP_Error object or not: $id = wp_insert_post(...); if (is_wp_error($id)) { $errors = $id->get_error_messages(); foreach ($errors as $error) { echo $error; //this is just an example and generally not a good idea, you should implement means of processing the errors further down the track and ...


10

The JavaScript function wp_attempt_focus is causing this issue. The function fires shortly after page load, clears the form and focuses on it, forcing users to manually enter their login information. Chrome is filling in the username and password automatically, just milliseconds before the JS function clears the field. Chrome does not properly pick up the ...


9

From class Walker_Nav_Menu: function start_lvl( &$output, $depth = 0, $args = array() ) Your child class must use the same signature: three arguments, the first one passed by reference. Every difference will raise the error you got. Note that $args defaults to an empty array, but you get an instance of stdClass, not an array. This is WordPress.


9

http://yoast.com/custom-wordpress-database-error-pages/ You can make your own Database Error page by adding a db-error.php to your wp-content folder (/wp-content/db-error.php). You can find a good example of such a page in the link above. Don't forget adding header("HTTP/1.0 500 Internal Server Error"); in that file so it get a proper header message.


9

Do not just upgrade immediately. Take the time you need for an informed decision. And make a backup, of course. :) Read the changelog for the new version. Example for 3.4.1. The blog announcements and the Codex pages are not complete. Test the upgrade with an exact copy of your production site, including plugins and themes. Add, change and delete an ...


8

It's a bug: http://core.trac.wordpress.org/ticket/11831


8

It means that the declaration of the start_lvl method in wp_bootstrap_navwalker should match the declaration of the method in Walker_Nav_Menu. It doesn't. function start_lvl( &$output, $depth ) { VS. function start_lvl( &$output, $depth = 0, $args = array() ) { Make the arguments match exactly and you should be fine. And you should probably ...


7

function is_php4(){ return version_compare(phpversion(),'5','<'); }


7

Survey said! Wolf Fence in Alaska. The basic idea is that you divide your problem space in half by inserting a print "Hi, Mom!\n"; exit; (insert your favorite phrase) somewhere near the "middle" of your code. If you get the message, then the bug is beyond where you put the print, so move it farther along in the execution. If you don't get there, move the ...


7

There are several components to error/notice creation and display process: add_settings_error() call to add item to stack (global $wp_settings_errors variable). settings_errors transient that keeps the errors so they survive move from page to page. settings_errors() function get_settings_errors() to retrieve errors from memory or transient and then ...


7

Since version 3.4 (or earlier?) WordPress sends a special HTTP header (not in HTML) on login and admin pages: X-Frame-Options: SAMEORIGIN So your browser will show you some text built into the browser, not sent from WordPress. From wp-includes/default-filters.php: add_action( 'login_init', 'send_frame_options_header', 10, 0 ); add_action( ...


6

Remove the call to $wpdb->prepare(): $result = $wpdb->get_var( "SELECT DISTINCT meta_value FROM $metatable WHERE meta_key LIKE '%matchme%' AND meta_value IS NOT NULL AND meta_value <> ''" ); In this case, the $wpdb->prepare() function is not doing anything. There are no variables holding unknown values, therefore there is no ...


6

I spent several hours of my Saturday looking for this error. I could not find a guide anywhere on the 'net that described my eventual solution. Here is my solution. In the WP core, the "You do not have sufficient permissions to access this page." error is generated at the end of /wp-admin/includes/menu.php. A grep of my plugin directories also showed that ...


6

Let’s start with the output we got before the fix: What happened here? My guess: a collision between the plugin W3 Total Cache and your web server LiteSpeed. I found a thread in a Drupal forum about a very similar (or the same) issue. LiteSpeed seems not to send the appropriate HTTP headers for the compressed cache files W3TC stores. In its changelog for ...


6

You're probably talking about theming wp_die(), which is the function that produces those grey error pages with a white box of text in them. For a plugin solution, you could try this plugin, which says it does what you want. Not sure about version support though--it says it only works up to 3.1.4. For a programatic solution, you'll want to hook into the ...


6

You have to include /path/to/wordpress/wp-admin/includes/file.php this file also, as the media.php uses the function download_url() from that file.


6

Store errors in your class or as a global, possibly in a transient or meta, and display them in admin notices on POST requests. WP does not feature any flash message handler.


5

Try this code: WARNING: THIS IS JUST PSEUDOCODE! $entries = $wpdb->get_results("SELECT * FROM wp_posts WHERE post_type IN ('post', 'page')"); foreach($entries as $entry) { $post_id = $entry->ID; $comment_count = $wpdb->get_var("SELECT COUNT(*) AS comment_cnt FROM wp_comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1'"); ...


5

Seems to be a common problem. Try this plugin: http://wordpress.org/extend/plugins/web-ninja-comment-count-fixer/


5

There are multiple tools and possibilities, and shure it would be nice to have something quick at hand. I know plugin authors who do offer debug flags so you can analyze what's going on quite easy. As for plugins, I have not tested it but looked at some screenshots and it is at least informative: Debug Bar (Wordpress Plugin) and the BlackBox Debug Bar ...


5

Because widget_name::__construct() calls WP_Widget::WP_Widget(), which in turn calls widget_name::__construct() etc. A simple solution would be to make widget_name::__construct() call WP_Widget::__construct() directly. Also see http://core.trac.wordpress.org/ticket/16768#comment:9



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