Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author George Notaras

    (@gnotaras)

    Hi,

    There had been some controversy in the past about this specific functionality. Currently, a workaround might be possible by using the various filters.

    Nevertheless, I’ll look into it and the next release (or the release after that) will have two specific filter hooks which will be used to stop generating a description and keywords if such data has not been entered manually by the user.

    Please note that such changes could affect all metadata generators.

    George

    Thread Starter the travel writer

    (@flyerdave)

    Hi George

    Thanks for your quick response.

    If you have any temporary code fix I would be very grateful to know it as I have over 1500 pages on my site (which I have just transferred to a new url). Most of them are showing some very strange meta descriptions.

    This is where WP (indeed most other CMS) is/are OK for blogs but not so good when it comes to serious websites such as mine due to the minimal control you have in the code for individual pages.

    WP is great in what it does, but it certainly has it’s limitations which is why I may decide to revert to good old HTML as you can have total control on what displays on the static page and if you wish to use separate template designs within a site, (something that is almost impossible to achieve with any CMS) it is easy to do on a HTML site. Try using 1500 unique page designs with a CMS site!

    Thanks again for your plugin, I am sure many others benefit from your hard work.

    Plugin Author George Notaras

    (@gnotaras)

    Hi Dave. I see. I had to write a workaround from scratch. The following should do the trick. It’ll work with any plugin release, but FYI the next version will have some filter hooks which will hopefully facilitate this process.

    function amt_basic_limit_autogenerated_metatags( $metatags ) {
        if ( is_singular() ) {
            $metatags_new = array();
            $post = get_queried_object();
            foreach ($metatags as $metatag ) {
                if ( strpos($metatag, 'name="description"') !== false ) {
                    // We have a description metatag
                    // Get user-defined description from metabox
                    $custom_description = amt_get_post_meta_description($post->ID);
                    if ( ! empty($custom_description) ) {
                        $metatags_new[] = $metatag;
                    }
                } elseif ( strpos($metatag, 'name="keywords"') !== false ) {
                    // We have a keywords metatag
                    // Get user-defined keywords from metabox
                    $custom_keywords = amt_get_post_meta_keywords($post->ID);
                    if ( ! empty($custom_keywords) ) {
                        $metatags_new[] = $metatag;
                    }
                } else {
                    $metatags_new[] = $metatag;
                }
            }
            return $metatags_new;
        }
        return $metatags;
    }
    add_filter( 'amt_basic_metadata_head', 'amt_basic_limit_autogenerated_metatags' );

    Put the above snippet in the functions.php file of the theme. Please let me know if it works.

    George

    Thread Starter the travel writer

    (@flyerdave)

    Hi George

    Placed your code in the theme functions.php and noticed the following.

    When “Automatically generate the description meta tag.” and “Automatically generate the keywords meta tag.” are both checked on your plugin custom description and keywords placed on the page work fine and those pages without show nothing – just what I wanted- fantastic.

    If you uncheck “Automatically generate the description meta tag.” and “Automatically generate the keywords meta tag.” no description or keywords will show on any page. In other words it will remove all descriptions and keywords.

    A great bit of code and many thanks. Problem solved as far as I am concerned.

    Plugin Author George Notaras

    (@gnotaras)

    Hi Dave,

    Glad the snippet works. What you described is exactly what it was meant to be doing.

    I’ve filed a bug report in my issue tracker so that I also improve this functionality via an extra setting in the admin panel in future releases.

    Thanks for your feedback.

    George

    Plugin Author George Notaras

    (@gnotaras)

    Starting from v2.8.0, what you asked for can be done with the following code:

    add_filter( 'amt_generate_description_if_no_manual_data', 'amt_return_false' );
    add_filter( 'amt_generate_keywords_if_no_manual_data', 'amt_return_false' );

    This is more complete and affects all metadata generators and not just basic metadata like the code above.

    George

    Update: edited the filter names with the correct ones.

    Thread Starter the travel writer

    (@flyerdave)

    Hi George

    Just so I understand what you are saying above, In the latest version 2.8.0 do we replace the former code in the themes functions.php with the revised code above?

    thanks

    Plugin Author George Notaras

    (@gnotaras)

    Yes, the two line snippet replaces the bigger code snippet above. Please let me know if everything works as expected.

    Thread Starter the travel writer

    (@flyerdave)

    Hi George

    So far every thing seems to be in order.

    thanks for all your hard work.

    Plugin Author George Notaras

    (@gnotaras)

    Thanks for letting me know. Your feedback is welcome.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Auto generate’ is closed to new replies.