• Resolved tolkodelo

    (@tolkodelo)


    Hello,

    I have the autogenerate option enabled, but when I post a new post or page, the autognerated meta does not appear in wp_postmeta table. Is does appear in post AIOSEOP metabox in grey font, though, and the meta is added when I manually add my aioseop data on my post page.

    The plugin options are:

    (
    [aiosp_home_title] => (hidden)
    [aiosp_home_description] => (hidden)
    [aiosp_togglekeywords] => 0
    [aiosp_home_keywords] => (hidden)
    [aiosp_use_static_home_info] => 0
    [aiosp_can] => on
    [aiosp_no_paged_canonical_links] =>
    [aiosp_customize_canonical_links] =>
    [aiosp_rewrite_titles] => 1
    [aiosp_force_rewrites] => 1
    [aiosp_use_original_title] => 0
    [aiosp_home_page_title_format] => %page_title%
    [aiosp_page_title_format] => %page_title% | %blog_title%
    [aiosp_post_title_format] => %post_title% | %blog_title%
    [aiosp_category_title_format] => %category_title% | %blog_title%
    [aiosp_archive_title_format] => %archive_title% | %blog_title%
    [aiosp_date_title_format] => %date% | %blog_title%
    [aiosp_author_title_format] => %author% | %blog_title%
    [aiosp_tag_title_format] => %tag% | %blog_title%
    [aiosp_search_title_format] => %search% | %blog_title%
    [aiosp_description_format] => %description%
    [aiosp_404_title_format] => Ничего не найдено для %request_words%
    [aiosp_paged_format] => – Part %page%
    [aiosp_cpostactive] => Array
    (
    [0] => post
    [1] => page
    [2] => attachment
    )

    [aiosp_cpostnoindex] =>
    [aiosp_cpostnofollow] =>
    [aiosp_posttypecolumns] => Array
    (
    [0] => post
    [1] => page
    )

    [aiosp_google_verify] =>
    [aiosp_bing_verify] =>
    [aiosp_pinterest_verify] =>
    [aiosp_google_publisher] =>
    [aiosp_google_disable_profile] =>
    [aiosp_google_sitelinks_search] =>
    [aiosp_google_set_site_name] =>
    [aiosp_google_specify_site_name] =>
    [aiosp_google_author_advanced] => 0
    [aiosp_google_author_location] => Array
    (
    [0] => all
    )

    [aiosp_google_enable_publisher] => on
    [aiosp_google_specify_publisher] =>
    [aiosp_google_analytics_id] =>
    [aiosp_ga_advanced_options] => on
    [aiosp_ga_domain] =>
    [aiosp_ga_multi_domain] =>
    [aiosp_ga_addl_domains] =>
    [aiosp_ga_anonymize_ip] =>
    [aiosp_ga_display_advertising] =>
    [aiosp_ga_exclude_users] =>
    [aiosp_ga_track_outbound_links] =>
    [aiosp_ga_link_attribution] =>
    [aiosp_ga_enhanced_ecommerce] =>
    [aiosp_use_categories] => on
    [aiosp_use_tags_as_keywords] => on
    [aiosp_dynamic_postspage_keywords] => on
    [aiosp_category_noindex] => on
    [aiosp_archive_date_noindex] => on
    [aiosp_archive_author_noindex] => on
    [aiosp_tags_noindex] =>
    [aiosp_search_noindex] =>
    [aiosp_404_noindex] =>
    [aiosp_tax_noindex] =>
    [aiosp_paginated_noindex] =>
    [aiosp_paginated_nofollow] =>
    [aiosp_generate_descriptions] => on
    [aiosp_skip_excerpt] => on
    [aiosp_run_shortcodes] =>
    [aiosp_hide_paginated_descriptions] =>
    [aiosp_dont_truncate_descriptions] =>
    [aiosp_schema_markup] => on
    [aiosp_unprotect_meta] =>
    [aiosp_redirect_attachement_parent] =>
    [aiosp_ex_pages] =>
    [aiosp_post_meta_tags] =>
    [aiosp_page_meta_tags] =>
    [aiosp_front_meta_tags] =>
    [aiosp_home_meta_tags] =>
    [aiosp_do_log] =>
    [last_active_version] => 2.12.1
    [aiosp_attachment_title_format] => %post_title% | %blog_title%
    [aiosp_oembed_cache_title_format] => %post_title% | %blog_title%
    [aiosp_user_request_title_format] => %post_title% | %blog_title%
    [aiosp_wp_block_title_format] => %post_title% | %blog_title%
    )

    Thanks for any help,
    Artem

    • This topic was modified 5 years, 10 months ago by tolkodelo.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    Autogenerated meta is created dynamically (on the fly) and is not stored in the database. Also, meta is stored in the postmeta table, not the options table.

    Thread Starter tolkodelo

    (@tolkodelo)

    Hi Michael!! ) Thank you for your answer!

    Ok, that solves my problem. You see, I stripped my WP of almost all front-end functionality that I don’t use in my project, so I don’t currently use wp_head().

    Is there a function I can call from my header to place autogenerated meta in it? Or maybe you can point out a place in the plugin code so I could work from there.

    Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    I’m sure it’s possible, but offhand I’m not sure what to suggest. It would take quite a bit of digging through the code.

    Thread Starter tolkodelo

    (@tolkodelo)

    Ok. I can see the logics of how the plugin generates meta, so I guess I can write the functions myself. Or better fill out the meta fields ??
    Thank you for your reply!

    Thread Starter tolkodelo

    (@tolkodelo)

    I’ll place this code here in case someone stumbles upon this thread. I ended up writing my own little code snippet to incorporate AIOSEOP into header.php without using wp_head(), and to autogenerate description and (optional) keyword meta. Here it is:

    /*All in one SEO Pack with no wp_head()*/
    /* options*/
    $tdl_keywords_on = true; // add keywords? set to false to disable
    $tdl_keywords = ''; // default keywords
    $tdl_search_keywords = ''; // keywords for search.php
    $tdl_description = ''; // default description
    $tdl_search_description = ''; // description for search.php
    $tdl_taxonomy_description = ''; // default part of taxonomy description. Will be paired with keywords
    /* end of options*/
    
    $tdl_p = ", "; $eol = "\r\n";
    $tdl_object = get_queried_object();						//get current object
    $tdl_post_meta = get_post_meta(get_queried_object_ID()); //get object meta
    if(is_search() == false){ //if any part of site but search
    	/*KEYWORDS*/
    	if(!empty($tdl_post_meta['_aioseop_keywords'])) { //if keywords were filled out manually, use them
    		$tdl_keywords = str_replace('"','\"',reset($tdl_post_meta['_aioseop_keywords'])); 
    	} else { //if no keywords found, autogenerate
    		if(is_category() || is_archive()){ //if object is category or archive
    		$tdl_keywords = $tdl_keywords->cat_name;	
    		} else {										//if it's a single page/post
    			$tdl_keywords = $tdl_object->post_title;	
    		};
    		$taxonomies = wp_get_post_terms(get_the_ID(), 'post_tag', array('fields' => 'names'));
    		$taxonomies = array_merge ($taxonomies, wp_get_post_terms(get_the_ID(), 'category', array('fields' => 'names')));
    		//$taxonomies = array_merge ($taxonomies, wp_get_post_terms(get_the_ID(), 'YOUR_CUSTOM_TAXONOMY', array('fields' => 'names'))); //uncomment for your custom taxonomies and change YOUR_CUSTOM_TAXONOMY to desired taxonomy
    			$tdl_keywords .= (!empty($taxonomies))?(!empty($tdl_keywords))?', '.implode(', ', $taxonomies):implode(', ', $taxonomies):'';
    	};
    	/*DESCRIPTION*/
    	if(!empty($tdl_post_meta['_aioseop_description'])) {	//if description is filled out manually, use it
    		$tdl_description = str_replace('"','\"',reset($tdl_post_meta['_aioseop_description'])); 
    	} else { //if no keywords found, autogenerate
    		if(is_category() == false && is_archive() == false){ 				//if object is NOT a category or archive
    			$text = str_replace(array("\r\n","\r","\n"),' ',str_replace(array('"'),'',wp_strip_all_tags(get_post_field('post_content',get_the_ID()))));
    			$length = 150;
    			if(mb_strlen($text)<$length) {
    				$tdl_description = $text;
    			} else {
    				$break_pos = mb_strpos($text, ' ', $length);//find next space after desired length
    				$tdl_description =  balanceTags(mb_substr($text, 0, $break_pos));
    			};
    		} else {
    			$tdl_description = $tdl_taxonomy_description.' '.$tdl_keywords;
    		};
    	};
    } else { //if we're on search.php, use default keywords and description
    	if(!empty($_GET['s']) && $_GET['s'] !== '' && isset($_GET['s'])){
    		$tdl_keywords = $_GET['s'];
    	} else {
    		$tdl_keywords = $tdl_search_keywords;
    	};
    	$tdl_description = $tdl_search_description;
    }
    echo (!empty($tdl_description))? '<meta name="description" content="'.$tdl_description.'"/>'.$eol:'';
    echo ($tdl_keywords_on == true && !empty($tdl_keywords))? '<meta name="keywords" content="'.mb_strtolower(str_replace(array(':','?','!',';','.','"'),'',$tdl_keywords)).'"/>'.$eol:'';
    /*End*/
    • This reply was modified 5 years, 9 months ago by tolkodelo.
    • This reply was modified 5 years, 9 months ago by tolkodelo.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Autogenerated meta not added to database’ is closed to new replies.