Title: Help With Plugin Scope Issue
Last modified: August 18, 2016

---

# Help With Plugin Scope Issue

 *  [cavemonkey50](https://wordpress.org/support/users/cavemonkey50/)
 * (@cavemonkey50)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/help-with-plugin-scope-issue/)
 * I’m having some issue with the scope of a variable in a plugin I’m trying to 
   create. The plugin is to add support for RSS tracking in Mint. To do this, a 
   Mint include must be added to the RSS file and the links have to be replaced 
   with the tracking code.
 * The include needed at the top of the RSS file is:
 * `<?php
    define('BIRDFEED', 'Feed Name'); include($_SERVER['DOCUMENT_ROOT'].'/
   feeder/index.php'); ?>
 * The links are supposed to be this:
 * `<?php $BirdFeeder->seed(get_the_title_rss(), get_permalink()); ?>`
 * Here’s my plugin at the moment:
 * `if ( is_feed() ) {
    define('BIRDFEED', 'Articles (RSS)'); include($_SERVER['
   DOCUMENT_ROOT'].'/feeder/index.php'); } function rh_bird_feeder_include ($url){
   if ( is_feed() ) $url = $BirdFeeder->seed(get_the_title_rss(), $url); return 
   $url; } add_filter ('post_link', 'rh_bird_feeder_include', 1);
 * That results in an “Call to a member function on a non-object in …” telling me
   that the $BirdFeeder variable is not declared. To remedy this, I have tried adding
   global $BirdFeeder to the function without avail.
 * Thinking it might be an issue with the way Mint is including the code, I did 
   a simple test with a basic variable.
 * `$test = "Global works";
    function rh_bird_feeder_include ($url) { global $test;
   if ( is_feed() ) $url = $test; } add_filter ('post_link', 'rh_bird_feeder_include',
   1);
 * Unfortunately that doesn’t work either. How can resolve this scope issue and 
   get the information from $BirdFeeder into the function?

Viewing 1 replies (of 1 total)

 *  Thread Starter [cavemonkey50](https://wordpress.org/support/users/cavemonkey50/)
 * (@cavemonkey50)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/help-with-plugin-scope-issue/#post-515295)
 * Does anyone have any ideas on what’s the problem? I can provide more information
   if needed.

Viewing 1 replies (of 1 total)

The topic ‘Help With Plugin Scope Issue’ is closed to new replies.

## Tags

 * [global](https://wordpress.org/support/topic-tag/global/)

 * 1 reply
 * 1 participant
 * Last reply from: [cavemonkey50](https://wordpress.org/support/users/cavemonkey50/)
 * Last activity: [19 years, 4 months ago](https://wordpress.org/support/topic/help-with-plugin-scope-issue/#post-515295)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
