Explore xNepali - xN Home | Movies & Fun | Nepali Blog | Photo Blog | Tools - | Unicode | Nepali Fonts | Preeti->Unicode
RSS feed

  • Unicode text turned garbage and ?s in WordPress blog


    unicode-starts working Our blog – blog.xnepali.com is basically an English site. But, the movies posted there are in Nepali language – so we were posting the name of the movie in Nepali text.

    Recently for some unknown reason the cache plugin ‘Hyper Cache’ stopped working and I had to play around with the settings. After a couple of days I realize the text in the site have gone crazy.

    While searching the WordPress support I found out that the solution to the problem was the configuration file "wp-config.php". When I restored the back-up of the file, the unicode start to look fine.

    To troubleshot what might have happened, I removed some of the lines that were not present in the original files were and restored the new config file.

    The problem were the two lines in the config file:

    config-file

    Read the rest of this entry »

    Incoming search terms:


  • WordPress Rewrite rules – ballooning wp-options table


    When xNepali blog grew in size, the database load on the server was huge. We had to move to the Virtual Private Servers to deal with. But, to our surprise, we had to constantly play around with the memory to get the optimum result. There were a lot of times when database ‘max_allowed_packet’ bytes error were observed in error logs.

    To solve the database connection we tried adding another private server for database. But, it didn’t solve anything.

    In the blog there were about 400 pages. Somebody suggested that a lot of pages were not good for the server. We started migrating the pages to posts as post have better flexibility and more keyword options (like tags) than pages. Now, the number of pages are only about 200. But, the problem is still the same.

    I checked the rewrite-rules column in the wp-options table. It was almost 1mb in size.  There are
    if( is_array( $attachment_uris ) ) {
    foreach ($attachment_uris as $uri => $pagename) {
    $this->add_rewrite_tag('%pagename%', "($uri)", 'attachment=');
    $rewrite_rules = array_merge($rewrite_rules, $this->
    generate_rewrite_rules($page_structure, EP_PAGES, true, false));
    }
    }

    In addition, I added the following code in the function.php in the theme:


    function filter_rewrite_attachment($content) {
    if (!is_array($content))
    return $content;
    foreach ($content as $key => $val) {
    if (strpos($val, 'attachment') !== false)
    unset($content[$key]);
    }
    return $content;
    }
    add_filter('page_rewrite_rules', 'filter_rewrite_attachment');
    add_filter('post_rewrite_rules', 'filter_rewrite_attachment');

    The first code didn’t have much effect in the database size. The second code by Johan Eenfeldt from wp-hackers group did help reducing the table size. I need to wait for at least a day to see what performance enhancement or problem it will cause.

    Incoming search terms: