Support » Plugin: All in One SEO Pack » Add Post Title as First Keyword Automatically?

  • Resolved meanstreak


    I am trying to somewhat automate my SEO. The dynamic keyword function does not work on my All in One SEO plug in. I would like to have the post title automatically be the first keyword for each posting.

    Does anyone know where and what file I might be able to insert <?php the_title(); ?> into the All in One SEO code to make this happen? I have searched all the files and made several attempts with no luck.

    Thanks for the help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • I think it could be located here. I have tried several test with no success.


    ( isset( $keywords ) && $togglekeywords == 0 && !empty( $keywords ) && !( is_home() && is_paged() ) ) {
    if ( isset( $meta_string ) ) $meta_string .= “\n”;
    $keywords = str_replace( ‘”‘, ”, $keywords );
    $meta_string .= sprintf( “<meta name=\”keywords\”the_title, \”%s\” />\n”, $keywords );

    Plugin Contributor Peter Baylies



    Add this code to the functions.php of your theme or into a plugin:

    add_filter( 'aioseop_keywords', 'meanstreak_add_title_to_keywords' );
    function meanstreak_add_title_to_keywords( $keywords ) {
    	global $post;
    	if ( !empty( $post ) ) {
    		if ( empty( $keywords ) )
    			$keywords = $post->post_title;
    			$keywords = $post->post_title . ", " . $keywords;
    	return $keywords;

    Thanks for the help. I tried the code in both Wp function AIONSEO function like you mentioned. I changed meanstreak to my theme name twentytwelve.

    Upon removing the code from the function file(s), the site keeps timing out with a 500 server error.

    I replace the edited files with backups, but the site still will not connect. Did this code add anything to the database?

    Thanks again for taking the time to respond!

    Plugin Contributor Peter Baylies



    If you change the name of the function, make sure you change it in both places – in the add_filter() call and in the function name. This code doesn’t add anything to the database, removing it should reverse whatever effects it has.

    Thanks for the quick reply. I’m not sure what I did wrong. this is the error code that I am receiving when I edit both files.

    Fatal error: Cannot redeclare twentytwelve_add_title_to_keywords() (previously declared in /wp-content/plugins/all-in-one-seo-pack/aioseop_functions.php:519) in /wp-content/themes/twentytwelve/functions.php on line 499

    If i just edit one file (function.php or aioseo_functions.php), the site times out. I will do a restore of the server files to return the site to its original state, unless you might have any additional suggestions.

    Thanks for all your help!

    Plugin Contributor Peter Baylies



    It looks like you have this function declared in two places; remove it from either location, provided that it is the same function and not a different function with the same name (that’s why I prefaced my function with meanstreak rather than with twentytwelve).

    Makes sense. Thanks again for the help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Add Post Title as First Keyword Automatically?’ is closed to new replies.