Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter pascalwp

    (@xmedias)

    Its not a browser cache problem.

    Thread Starter pascalwp

    (@xmedias)

    I found the solution

    add_action( 'wp', 'addtx_homeheader' );
    function addtx_homeheader()
    {
    
    if(is_front_page())
    {
    add_action('wp_head', '_set_metatag');
    }
    }
    
    function _set_metatag()
    {
    $output = '';
    $output .= '<meta property="og:type" content="MYPLUGINTEST" />';
    echo $output;
    }
    Thread Starter pascalwp

    (@xmedias)

    No
    If I use is_front_page() or is_home not working by using is in a custom plugin.

    But this works when I put that directly in header.php

    if(is_front_page())
    {
    $output = '';
    $output .= '<meta property="og:type" content="website" />';
    echo $output;
    }

    Why this is not working if a create it in a plugin?

    if(is_home())
    {
    add_action('wp_head', '_set_metatag');
    }
    
    function _set_metatag()
    {
    $output = '';
    $output .= '<meta property="og:type" content="website" />';
    $output .= '<meta property="og:url" content="https://website.com" />';
    $output .= '<meta property="og:title" content="websitetitle" />';
    echo $output;
    }

    Note : I tested is_home() and is_front_page()

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