• Resolved eiland

    (@eiland)


    I need to disable this plugin on certain funky wordpress pages, and i’m looking at the fb_og_enabled-filter, but i dont understand how i can unset this in my code?

Viewing 1 replies (of 1 total)
  • Thread Starter eiland

    (@eiland)

    Ok nailed it:

    <?php

    /* Plugin Name: zzz-disable-opengraph */

    if( multi_strpos($_SERVER[ 'SCRIPT_FILENAME'], array('myscript.php', 'domain.com/folder/')) !== false ) {
    add_filter("fb_og_enabled", function($enabled){ enabled = false; }, 10, 1 );
    }

    /**
    * Multi string position detection. Returns the first position of $check found in
    * $str or an associative array of all found positions if $getResults is enabled.
    *
    * Always returns boolean false if no matches are found.
    *
    * @param string $str The string to search
    * @param string|array $check String literal / array of strings to check
    * @param boolean $getResults Return associative array of positions?
    * @return boolean|int|array False if no matches, int|array otherwise
    */
    function multi_strpos($string, $check, $getResults = false)
    {
    $result = array();
    $check = (array) $check;

    foreach ($check as $s)
    {
    $pos = strpos($string, $s);

    if ($pos !== false)
    {
    if ($getResults)
    {
    $result[$s] = $pos;
    }
    else
    {
    return $pos;
    }
    }
    }

    return empty($result) ? false : $result;
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.