WP-Bitly 2.3 creating links it should not
-
I just noticed that WP-Bitly was creating shortlinks for all of my attachment pages. The configuration was set for posts and pages only.
I found the bug:
In includes/functions.php, line 106 is:
if ( !in_array( $post_type, $post_types ) && !in_array( $post_status, array( 'publish', 'future', 'private') ) )
and it should be:
if ( !in_array( $post_type, $post_types ) || !in_array( $post_status, array( 'publish', 'future', 'private') ) )
The logic operator should be OR, not AND.
While trying to debug this, I found another problem:
In includes/functions.php, line 27 is:
fwrite( $log, ( is_array( $towrite ) ? print_r( $towrite, true ) : var_dump( $towrite ) ) );
But var_dump() writes directly to the browser. Just use print_r() in all cases:
fwrite( $log, print_r( $towrite, true ) );
- The topic ‘WP-Bitly 2.3 creating links it should not’ is closed to new replies.