Forum Replies Created

Viewing 3 replies - 241 through 243 (of 243 total)
  • Thread Starter Mitchell Bennis

    (@eemitch)

    Thanks. That helped, but it made me more confused. It’s only returning 20 posts, which indeed are missing any category, yet there are 3844 published posts which are not accounted for on the admin > posts > categories page.

    What would cause the WP_Query to be limited to 20 posts?

    $postsWithoutCategories = new WP_Query(array(
    	    'post_type'         => 'post',
    	    'category__not_in'  => get_terms('category', array(
    	        'fields'        => 'ids'
    	    ))
    	));
    
    	$pwncArray = $postsWithoutCategories->posts;
    
    	$pwnc = count($pwncArray);
    
    	echo 'Number of posts with no category: ' . $pwnc; // Says 20
    
    	print_r($postsWithoutCategories->posts); // Shows the 20 posts
    Thread Starter Mitchell Bennis

    (@eemitch)

    Agreed, the integration could be better, you have to re-add the snippet each time WP updates. For now, concept thinking…

    UPDATE – Added POST Referrer Check

    // WordPress Tweak - Stop Unauthorized Access to Keep Hackers Out
    // Author: [email protected] - rev 12.15.15
    // 1) Add this snippet to the top of the WordPress wp-login.php file, right after the bootstrap line.
    // 2) Create a PIN and update the constant
    // 3) Pass the PIN thru the login URL in order to access the page: /wp-login.php?eePIN=xxxx
    // ... Otherwise you get redirect away and never see the login form. So long bad guys...
    
    // The page access PIN
    define('eePIN', 'xxxx'); // Set to whatever your heart desires.
    
    // The Redirect URL
    define ('eeAWAY', 'https://elementengage.com/welcome-hackers/'); // Same same, but you can leave it like this.
    
    if(@$_POST['log'] OR (@$_GET['action'] == 'logout' AND check_admin_referer('log-out'))) { // Login or Logout
    
    	// Check the form was submitted from here.
    	if(!strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) {
    
    		header('Location: ' . eeAWAY);
    		exit;
    	}
    
    } elseif(@$_GET['loggedout']) {  // Logged out	
    
    	header('Location: https://' . $_SERVER['HTTP_HOST']);
    	exit;
    
    } else {
    
    	// This PIN must be passed in order to access this page
    	$thePIN = @$_GET['eePIN'];
    	if($thePIN != eePIN) {
    		header('Location: ' . eeAWAY);
    		exit;
    	}
    }
    Thread Starter Mitchell Bennis

    (@eemitch)

    Redirect bug fix…

    // The page access PIN
    define('eePIN', 'xxxxx'); // Set to whatever your heart desires.
    
    // The Redirect URL
    define ('eeAWAY', 'https://elementengage.com/welcome-hackers/'); // Same same, but you can leave it like this.
    
    if(@$_POST['log'] OR (@$_GET['action'] == 'logout' AND check_admin_referer('log-out'))) { // Login or Logout
    	// Proceed normally
    
    } elseif(@$_GET['loggedout']) {  // Logged out	
    
    	header('Location: https://' . $_SERVER['HTTP_HOST']);
    	exit;
    
    } else {
    
    	// This PIN must be passed in order to access this page
    	$thePIN = @$_GET['eePIN'];
    	if($thePIN != eePIN) {
    		header('Location: ' . eeAWAY);
    		exit;
    	}
    }
Viewing 3 replies - 241 through 243 (of 243 total)