Solved Allowed memory size of 33554432 bytes exhausted

Solved: header function issue with WordPress

we solved header function issue with WordPress. If you are facing issue with redirecting the one page or post to another page.

All PHP programmer always first try header() function. But when you use header function in worpdress that will not allow you to redirect the page.

Solved: header function issue with WordPress

Instead of using the header function please use wp_redirect() function which is provided by WordPress API.

<?php

global $post; // if outside the loop

if ( is_page() && $post->post_parent ) {

// This is a subpage

wp_redirect(get_option(‘siteurl’) . ‘/wp-login.php’);

} else {

// This is not a subpage

wp_redirect(get_option(‘siteurl’) . ‘/wp-login.php’);

}

?>

Use following URLs for reference.

http://codex.wordpress.org/Conditional_Tags

http://codex.wordpress.org/Function_Reference/wp_redirect

Solved for WordPress old and new versions - PHP Fatal error: Allowed memory size of 33554432 bytes exhausted
Solved for WordPress old and new versions – PHP Fatal error: Allowed memory size of 33554432 bytes exhausted

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

Leave a Reply

Your email address will not be published.