phpwordpresscustom-taxonomyyoastwpallimport

WordPress: Export Yoast meta title & description from custom taxonomy with WP All Export


I want to export the Yoast meta title & description from a custom taxonomy with the WP All Export. Unfortunately there is no direct way with the plugin to do that.

There is an extra WP All Export addon for Yoast but it doesn't work for custom taxonomies.

I tried to use a custom function in the export to get the title and description. But my function doesn't work either. Im not sure why.

Here's my current function:

function yoast_wpseo_title($value) {
    
    $my_yoast_wpseo_title = WPSEO_Taxonomy_Meta::get_term_meta($this->term, $this->term->taxonomy, 'title');
    if( $my_yoast_wpseo_title ){
        return $my_yoast_wpseo_title;
    } else {
        return '';
    }
    
}

I'm using the function in the function editor within the export. Like this:

enter image description here

Is there anything that I'm missing? Or isn't it possible that way?

Maybe there's another option to export these fields (and import them later)?


Solution

  • Try this:

     function yoast_wpseo_title($value) {
        $my_yoast_wpseo_title = WPSEO_Taxonomy_Meta::get_term_meta($value, 'taxonomyname', 'title');
        if( $my_yoast_wpseo_title ){
            return $my_yoast_wpseo_title;
        } else {
            return '';
        }
    }
    

    In yoast_wpseo_title the parameter $value will get the Term ID value.

    You can also change the input field "Column name" from "ID" to "yoast_seo_title".