Joomla version 1.7 Wordpress plugin enabled in admin part

Wordpress plugin code:

// no direct access
defined('_JEXEC') or die;


class plgSystemMetatags extends JPlugin
    public function __construct(&$subject, $config)
        parent::__construct($subject, $config); 

    public function onBeforeRender()
        $document =& JFactory::getDocument();
        $document->setMetaData('keywords', 'test keywords');    

But this does not work

Meta description renders value, which occur global configuration

wordpress plugin xml file

<?xml version="1.0" encoding="utf-8"?>
<extension version="1.7" type="plugin" group="system" method="upgrade" client="site">
    <name>System - Metatags</name>
    <author>Joomla! Project</author>
    <creationDate>November 2005</creationDate>
    <copyright>Copyright (C) 2005 - 2011 Open Source Matters. All rights reserved.</copyright>
    <license>GNU General Public License version 2 or later; see LICENSE.txt</license>

        <filename plugin="metatags">metatags.php</filename>


use onBeforeRender rather than onAfterRender.

When onAfterRender event is triggered the creation of the applying has already been obtainable in the response buffer.