• Resolved mykhaylopetrov

    (@mykhaylopetrov)


    Hello. A separate page has been created. In the admin menu Setting – Reading – Your homepage displays – Posts page it is specified as the page on which blog posts should be displayed (site.com/blog/). The title and description meta tags are listed for this page. Through the hook aioseo_description I want to change the content in the description. But the content of this tag changes exclusively on site.com/blog/. At site.com/blog/page/2, site.com/blog/page/3… the content description does not change. But I need to change the text only on the pagination pages. Please tell me how I can do this.

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

    (@arnaudbroes)

    Hey @mykhaylopetrov,

    I just confirmed on my local test site that you should be able to filter then paginated blog pages. Can you post the code snippet you’re using so I can take a look and see if there are any issues with it?

    Thread Starter mykhaylopetrov

    (@mykhaylopetrov)

    Hello. I’m trying this code:

    function lc_aioseo_filter_description( $description ) {
    	if ( is_front_page() && is_home() ) {
    		// Default homepage
    	} elseif ( is_front_page() ) {
    		// static homepage
    	} elseif ( is_home() ) {
    		// blog page
    		if ( is_paged() ) {
    			return 'Page ' . get_query_var( 'paged' ) . ' | ' . $description;
    		}
    		return $description;
    	} else {
    		//everything else
    	}
    }
    add_filter( 'aioseo_description', 'lc_aioseo_filter_description' );

    Although similar code works without problems in the case of the aioseo_title filter.

    Thanks.

    Plugin Author arnaudbroes

    (@arnaudbroes)

    return 'Page ' . get_query_var( 'paged' ) . ' | ' . $description;

    Is that the expected result?

    Thread Starter mykhaylopetrov

    (@mykhaylopetrov)

    YES. Before the description itself, I display the word “Page” with the page number of the pagination.

    Plugin Author arnaudbroes

    (@arnaudbroes)

    Can you post the URL of your website so I can take a look? In theory, the code snippet you’ve posted should work.

    Thread Starter mykhaylopetrov

    (@mykhaylopetrov)

    Here is one of the pages of the site:

    https://lanet.click/blog/page/2/

    The title meta tag changes normally. I use a similar code for it, only the aioseo_title filter.

    I use All in One SEO Pro 4.0.2

    Thanks.

    Plugin Author arnaudbroes

    (@arnaudbroes)

    I installed the version you’re using on my personal test site and a slimmed down version of your code snippet works perfectly fine – https://a.supportally.com/93SjgM

    I assume you didn’t post the full code snippet, so you might need to put some echo statements in it to find the cause of the issue.

    Thread Starter mykhaylopetrov

    (@mykhaylopetrov)

    Hi there. I’ve published all the code for you, which I use to change the description tag. If your code works for you, I will look for a problem in the code of active plug-ins and themes.

    I wonder why there are no changes even if the code is like this:

    function lc_aioseo_filter_description( $description ) {
    	return 'Page ' . get_query_var( 'paged' ) . ' | ' . $description;	
    }
    add_filter( 'aioseo_description', 'lc_aioseo_filter_description' );

    Please tell me a few points:

    1. Could this error occur in the old version of your plugin that I use?
    2. Can the filter be affected by any option in the graphical interface (on the plugin settings pages or individual site pages)?

    Thank you very much for your help.

    Thread Starter mykhaylopetrov

    (@mykhaylopetrov)

    Solved! The problem was that it was not known how these meta tags would be set (possibly by some third-party code). Decided as follows: for the blog page set them manually, opening in the editor.

    Thanks again for your help.

    Plugin Author arnaudbroes

    (@arnaudbroes)

    Aha, I’m great that you were able to figure it out! That totally makes sense. Glad I could help. ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Why the description tag is not overwritten?’ is closed to new replies.