Tag Info

Hot answers tagged

14

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


11

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


10

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


10

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


9

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


9

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


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

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


7

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


7

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.


7

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


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


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

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

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


5

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


5

There's not one if you didn't set one up. The codex has a good example of how to do this. <?php @ini_set('log_errors','On'); @ini_set('display_errors','Off'); @ini_set('error_log','/home/example.com/logs/php_error.log'); /** * This will log all errors notices and warnings to a file called debug.log in * wp-content (if Apache does not have write ...


5

This is a bug (one that I've encountered before) and could do with a ticket in trac (since I never took the time to submit one!) The trouble starts with requests that set multiple is_* query flags as true (specifically flags that represent objects, such as single posts, pages, and post type & term archives). This is because there can only ever be one ...


5

A white screen of death is typically a fatal PHP error, most of the time due to a syntax error. This often sends no errors to the browser. Some things you can do: Turn on PHP error_log in your php.ini file and set the error_reporting levels. http://php.net/manual/en/errorfunc.configuration.php Error info: ...


5

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


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

It's a common PHP error, usually when you try to access an array member with a non-existent key; $array = array( 'hello' => 'world' ); echo $array['foobar']; // undefined index You should check for the key first with isset( $array['foobar'] ); UPDATE: In this case, I would chuck in a loop that sets-up the variables for you, checking for the index in ...


5

I suggest to use sessions since this will not create strange effects when two users editing at the same time. So this is what I do: Sessions are not started by wordpress. So you need to start a session in your plugin, functions.php or even wp-config.php: if (!session_id()) session_start(); When saving the post, append errors and notices to the ...


5

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.


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


4

Check the permissions on the JS folder against the folders for the rest of the site.



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