Schema code for FAQ created with acf repeater Not working for category page.

#600524
  • Resolved Anonymous
    Rank Math free

    Hi. I Created FAQ with ACF Repeater field for posts and category. I make template for single post and category page with elementor and dynamic content for elementor (dynamic.ooo) and use code that you told in this url :
    https://rankmath.com/kb/automate-faq-schema-with-acf-repeater-fields/

    Everything is OK for single post but in category template, this schema Not showing in google rich result test. FAQ section that i created for category and single post template is the same config But FAQ Schema Not showing in category url.

    You can check rich result test for these two links.
    Thank you in advance.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hello,

    Thank you for your query and we are so sorry about the trouble this must have caused.

    Please ensure that you are using the latest version of Rank Math plugin. If not yet, please do update them. You may refer to our changelog page here: https://rankmath.com/changelog/

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress login in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Anonymous
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Anonymous
    Rank Math free

    Sent

    Hello,

    Also, upon checking your ACF settings, we noticed the primary field name and the row field name is different from the initial filter code that we have shared:

    Rank Math support

    Please make sure the field name matches the field name that you have in your filter code.

    We would like to check the code you have added to your website but we can’t access the theme editor and we also can’t temporarily install a file manager plugin as we are blocked.

    Can you please share an FTP login instead? Looking forward to helping you with this one.

    Thank you.

    Anonymous
    Rank Math free

    Hi. If the code was not correct, faq schema for blog posts also not worked.

    https://s29.picofile.com/file/8465754192/Screenshot_2023_07_11_215851.png

    this is my code that i added into my function.php

    Hello,

    We don’t have access to the Theme File Editor so we can’t check the functions.php file. The File Manager plugin is also not working. Please provide access to the theme file editor or share FTP access to your site so we can check this further.

    Looking forward to helping you.

    Anonymous
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    When I tried to upload the file after making changes to the code, FTP returned a critical error and your theme’s functions.php file went blank. Please restore it from your site’s backup. Sorry for the inconvenience caused.

    Fetching ACF field value for taxonomy is a little different than normal post. Please replace the filter you added before with this one to add the FAQ Schema:

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
    	if( ! have_rows('faq_cat') ) {
    		return $data;
    	}
    
    	$data['faqs'] = [
    		'@type' => 'FAQPage',
    	];
    	while( have_rows('faq_cat') ) {
    		the_row();
    		$data['faqs']['mainEntity'][] = [
    			'@type' => 'Question',
    			'name' => esc_attr( get_sub_field('faq_title') ),
    			'acceptedAnswer' => [
    			'@type' => 'Answer',
    			'text' => esc_attr( get_sub_field('faq_desc') ),
    			],
    		];
    	}
        if(is_category()) {
    		$quriedObject = get_queried_object_id( );
    		if( ! have_rows('faq_cat', "category_".$quriedObject) ) {
    		return $data;
    	    }
            $data['faqs'] = [
                '@type' => 'FAQPage',
            ];
            while( have_rows('faq_cat', "category_".$quriedObject) ) {
                the_row();
                $data['faqs']['mainEntity'][] = [
                    '@type' => 'Question',
                    'name' => esc_attr( get_sub_field('faq_title', "category_".$quriedObject) ),
                    'acceptedAnswer' => [
                    '@type' => 'Answer',
                    'text' => esc_attr( get_sub_field('faq_desc', "category_".$quriedObject) ),
                    ],
                ];
            }
        }
    	return $data;
    }, 10, 2 );

    I have checked it on my end and it is working fine.

    Hope that helps. Let us know if you need any other assistance.

    Anonymous
    Rank Math free

    Hi and thank you.
    1- this problem solved for new category that i make but previous category that created before, still not have FAQ schema. I try to save those category with some little change in content. But those category still not showing FAQ schema in google rich result test.
    2- In category archive page, i Put some description that i want to use it as an article schema. In article schema, How can i put category description and category Name for article schema instead of SEO TITLE and SEO DESCRIPTION?
    My category description have more content than SEO DESCRIPTION.
    3- in google search result page, description that shows under my site link is content that i write in Abstract section. I add seo description too, But it’s not showing in search result.
    can you check my rank math option for solving this?

    Hello,

    1. Please reactivate the login link and share the URL of an affected category so we can check.

    2. If you want to use the description of the category in the Article Schema applied to the post then you will have to modify and use the following filter: https://rankmath.com/kb/filters-hooks-api-developer/#change-post-schema-data

    3. Please share a screenshot of the issue and the affected URL so we can check and assist you further. You can use a tool like https://imgur.com/ to share the screenshots.

    Looking forward to helping you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 10 replies - 1 through 10 (of 10 total)

The ticket ‘Schema code for FAQ created with acf repeater Not working for category page.’ is closed to new replies.