Conditional logic in standard page title / descriptions

#146222
  • Resolved Neil Ingoe
    Rank Math free

    Hi,

    Is it possible, in either free or pro versions, to use conditional logic to set the key SEO fields (title, meta etc)?

    I have created my content programattically and included several fields which were designed for use in SEO, however not every content item has those fields – in some case they are blank and a fallback option needs to be used.

    I am thinking something like “If [fieldx] is blank then [standard_field] else [field x]”.

    Is this possible, and if so is there documentation anywhere?

    Thanks,
    Neil

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

    Thank you for getting in touch with us.

    Assuming you already have a condition to check if your field(s) are available on the posts/pages, you can use the filters here: https://rankmath.com/kb/filters-hooks-api-developer/#metadata to change the SEO data programmatically.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Thanks for the reply.

    Can I rephrase the question slightly? Is it possible via the GUI? My php skills are nowhere near good enough to implement any of that…

    Hello,

    Thank you for following up.

    You can use and modify the filter and it should be pasted on your theme’s functions.php file to work.

    On the other hand, you can also use this plugin to insert filters and hooks to your website:
    https://wordpress.org/plugins/code-snippets/

    I hope that helps. Thank you, and please don’t hesitate to contact us if you need further assistance.

    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 3 replies - 1 through 3 (of 3 total)

The ticket ‘Conditional logic in standard page title / descriptions’ is closed to new replies.