0

Why doesnt he input "$meinungen" ?

    add_filter('wpseo_set_title', 'wpseo_set_title_callback');
$meinungen = Test;
function wpseo_set_title_callback($input) {
    if (is_single()) {
        return ''. $meinungen . ''. $input . ' '. $input . '';
    }
    // return default
    return $input;
}

closed as off-topic by fuxia Oct 30 '16 at 13:10

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1

this is for Variable scope.

A variable declared within a function has a LOCAL SCOPE and can only be accessed within that function

A variable declared outside a function has a GLOBAL SCOPE and can only be accessed outside a function:

$meinungen = Test; // is in global scope
function wpseo_set_title_callback($input) {
if (is_single()) {
    return ''. $meinungen . ''. $input . ' '. $input . ''; // now $meinungen local variable which you don not assign value.
}
// return default
return $input; }

to call the value just put global with in function

function wpseo_set_title_callback($input) {
if (is_single()) {
   global $meinungen;
    return ''. $meinungen . ''. $input . ' '. $input . '';
}
// return default
return $input;

}

Not the answer you're looking for? Browse other questions tagged or ask your own question.