WonderCMS / wondercms

Fast and small flat file CMS (5 files). Built with PHP, JSON database.
https://wondercms.com
MIT License
642 stars 163 forks source link

Page hook changes meta tags #286

Closed izarif closed 1 year ago

izarif commented 1 year ago

Hello I installed WonderCMS 3.4.1 on my local server, created a page called "Product" and also created a simple plugin.

The code for the plugin is

<?php

global $Wcms;

$Wcms->addListener('page', 'displayProduct');

function displayProduct($args) {
    global $Wcms;

    if ($Wcms->currentPage != 'product') {
        return $args;
    }

    $args[0] .= 'Test content';

    return $args;
}`

After activating the plugin, If you check the contents of the title, description or keywords meta tags, you will notice that the line 'Test content' has been added there. How to change page content without changing meta tags?

robiso commented 1 year ago

Hey @iZarif. This is expected behaviour since you are changing all the arguments for the page.

You can find different ways of setting the description and everything you need on here: https://github.com/WonderCMS/wondercms/wiki/Set-data-to-database

Let me know if this helps. If it doesn't, feel free to keep to continue the discussion and we'll reopen the issue.