• Resolved waffeltje

    (@waffeltje)


    I’m having issues with the functionality of filled jobs being changed into noindex. I would like to use Rankmaths SEO tool’s functionality and some custom code the set filled jobs to noindex.
    Reference: https://support.rankmath.com/ticket/exclude-custom-post-type-with-specific-status-from-sitemap/?view=all

    In order to do that, I need to remove add_action( 'wp_head', [ $this, 'noindex_expired_filled_job_listings' ], 0 ); from class-wp-job-manager-post-types.php.

    I try to remove this action using the following code in functions.php, but it isn’t working:

    add_action( 'wp_head', 'remove_noindex_expired_filled_job_listings' );
    function remove_noindex_expired_filled_job_listings() {
        remove_action( 'wp_head', array( 'WP_Job_Manager_Post_Types', 'noindex_expired_filled_job_listings' ) );
    }

    Does anyone know how to remove this action without touching the plugin?

    Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @waffeltje

    I’ve seen you’ve mentioned that the filled/expired jobs are being turned to no-index; however, that’s completely normal behavior.

    That can be altered and changed with custom development; however, assisting with customizations is outside of our support policy.

    You can find more information about custom development below:

    https://wpjobmanager.com/custom-development/

    Best,

    Thread Starter waffeltje

    (@waffeltje)

    Hi Mehdi,

    Thanks for your reply. I know that it is normal behaviour of the plugin to set filled jobs to no-index. But since I’m having troubles with Rank Math SEO I want to remove this functionality from the WPJM plugin. Therefore my question how this can be achieved.

    I was hoping that someone in this community had an easy fix for this problem, and that it is a simple alteration to the line of code I posted above.

    Would love to find out if this can be achieved in a simple manner.

    Plugin Contributor Stef (a11n)

    (@erania-pinnera)

    Hi @waffeltje,

    I dug a little further, and perhaps the following snippet might help:

    /**
    * Allows filtering of the robots meta data.
    *
    * @param array $robots The meta robots directives.
    */
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
    global $post;
    if('job_listing' === get_post_type( get_the_ID() )){
    $robots['index'] = "noindex";
    return $robots;
    }
    return $robots;
    });

    I cannot guarantee this will work, but give it a try and let us know how it goes.

    Have you asked the folks at Rank Maths if they have an easier solution?

    • This reply was modified 2 years, 7 months ago by Stef (a11n).
    Plugin Support Jay

    (@bluejay77)

    Hi there,

    It has been more than one week since we have heard from you, so I’m marking this topic as resolved.

    But if you have any further questions or need some more help, you’re welcome to reply here or open another thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove action noindex_expired_filled_job_listings’ is closed to new replies.