Greg's High Performance SEO
[resolved] Filter not getting triggered (4 posts)

  1. gazpachu
    Posted 5 years ago #

    It's not working. Located in functions.php:

    add_filter('ghpseo_output', 'my_seo_output', 10, 2); 
    function my_seo_output($output='', $type='main') {
    	echo "hello";
        switch ($type) {
            //case "main": $result = $output; break;
            //case "main_title": $result = $output; break;
            //case "secondary_title": $result = $output; break;
            case "description": if( is_single() ) {
    								$standfirst = get_post_meta($wp_query->post->ID,'subtitle',true);
    								$result = '<meta name="description" content="' . $standfirst . '" />';
    							} else {
    								$result = $output;
            default: $result = $output;
        return $result;
  2. gazpachu
    Posted 5 years ago #

    I've placed the function calls in the header like this:

    <?php if (function_exists('ghpseo_output')) ghpseo_output('description'); ?>

    I've enabled the "Enable Output Modifications?" checkbox.

    The function is now triggered but it doesn't enter in the "description" case.

    What am I missing?

  3. gazpachu
    Posted 5 years ago #

    Not working :(

    Greg, please help me.


  4. gregmulhauser
    Plugin Author

    Posted 4 years ago #

    I would recommend reading the 'Instructions' tab of GHPSEO, where you'll find details on filtering the GHPSEO output function. By filtering the GHPSEO output function, you are not filtering anything else except that function -- in particular, you are not filtering the head meta description. If you'd like to filter the head meta description, you'd need to remove the plugin's built-in wp_head action 'head_desc' and provide one of your own instead (which could of course use the filterable GHPSEO output function).

    All the best,

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Greg's High Performance SEO
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic