Support » Plugin: Yet Another Related Posts Plugin (YARPP) » White Page when not publish a post

  • Resolved DZVO


    Hello Mitcho,
    my name is Maik, I use your Plugin on different Blogs.
    But in one Blog I have a problem.

    When I edit a post and I don’t publish the new version, then I get a white page for this posting.

    i used your plugin in my plugin 🙂
    here is the code

    Plugin Name: Google Ads!
    Plugin URI:
    Description: add Google Ads in the Blog posts
    Version: 0.1
    Author: Maik Schindler
    Author URI:
    add_action('plugins_loaded', 'msGoogleAdsInstall');
    add_filter('the_content', 'msGoogleAds');
    function msGoogleAdsInstall()
            global $wpdb;
            if(isset($_REQUEST['activate']) && $_REQUEST['activate'] == true){
                    $checkedTable = $wpdb->get_var("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_simple_google_ads' LIMIT 1");
                            $wpdb->query("INSERT INTO $wpdb->postmeta SET meta_key = '_simple_google_ads', meta_value = '1'");
            }elseif(isset($_REQUEST['activate']) && $_REQUEST['action'] == 'deactivate'
                    && isset($_REQUEST['plugin']) && $_REQUEST['plugin'] == 'google-ads/google-ads.php'){
                    $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = '_simple_google_ads'");
    function msGoogleAds($content = false)
            global $post;
            $ads = '<div class="ads">
                            <script type="text/javascript"><!--
                                    google_ad_client = "pub-8320213041632818";
                                    google_ad_width = 300;
                                    google_ad_height = 250;
                                    google_ad_format = "300x250_as";
                                    google_ad_type = "text";
                                    google_ad_channel = "5398256405";
                                    google_color_border = "FFFFFF";
                                    google_color_bg = "FFFFFF";
                                    google_color_link = "0058AF";
                                    google_color_text = "000000";
                                    google_color_url = "A01A00";
                            <script type="text/javascript"
                                    if (function_exists('related_entries')){
                                            $ads .= related_entries(array(), $post->ID, false);
                            $ads .= '
                    $ads = '';
            $content = str_replace('<!-- google ads -->', $ads, $content);
            return $content;

    here can you see the plugin in works…/

    Can you help me?
    Do you see what is the problem?


Viewing 5 replies - 1 through 5 (of 5 total)
  • You should look at your server error log which should tell you what the PHP error is. Also, you should turn on errors:

    Hello mitcho

    here is a php log
    [01-Mar-2013 19:10:10] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 74274 bytes) in /srv/www/vhosts/ on line 3773

    Oh, I see. You’re using a the_content filter to call YARPP. This is unsupported, because YARPP needs to look a the content of the post to do its computation, and therefore it is going to create an infinite loop.

    I suggest calling the code to display YARPP’s result outside of the_content.

    What a pity! Isn’t it possible to fix it for the next version? I think that, for SEO optimation reasons it is better, when related links are in the content and not under the content.

    best regards, Maik

    @dzvo for SEO reasons, it is irrelevant whether the related posts are technically inside the WordPress “content” or not. What matters is how the links are displayed on your site… if they’re grouped together with the content, I think search engines will pick it up as part of the content.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘White Page when not publish a post’ is closed to new replies.