Title: init
Published: April 25, 2014
Last modified: August 20, 2026

---

# init()

## In this article

 * [Source](https://developer.wordpress.org/reference/functions/init/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/init/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/init/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/init/?output_format=md#wp--skip-link--target)

Set up constants with default values, unless user overrides.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/init/?output_format=md#source)󠁿

    ```php
    function init () {
    	if ( defined('MAGPIE_INITALIZED') ) {
    		return;
    	}
    	else {
    		define('MAGPIE_INITALIZED', 1);
    	}

    	if ( !defined('MAGPIE_CACHE_ON') ) {
    		define('MAGPIE_CACHE_ON', 1);
    	}

    	if ( !defined('MAGPIE_CACHE_DIR') ) {
    		define('MAGPIE_CACHE_DIR', './cache');
    	}

    	if ( !defined('MAGPIE_CACHE_AGE') ) {
    		define('MAGPIE_CACHE_AGE', 60*60); // one hour
    	}

    	if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) {
    		define('MAGPIE_CACHE_FRESH_ONLY', 0);
    	}

    		if ( !defined('MAGPIE_DEBUG') ) {
    		define('MAGPIE_DEBUG', 0);
    	}

    	if ( !defined('MAGPIE_USER_AGENT') ) {
    		$ua = 'WordPress/' . $GLOBALS['wp_version'];

    		if ( MAGPIE_CACHE_ON ) {
    			$ua = $ua . ')';
    		}
    		else {
    			$ua = $ua . '; No cache)';
    		}

    		define('MAGPIE_USER_AGENT', $ua);
    	}

    	if ( !defined('MAGPIE_FETCH_TIME_OUT') ) {
    		define('MAGPIE_FETCH_TIME_OUT', 2);	// 2 second timeout
    	}

    	// use gzip encoding to fetch rss files if supported?
    	if ( !defined('MAGPIE_USE_GZIP') ) {
    		define('MAGPIE_USE_GZIP', true);
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rss.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/rss.php#L643)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/rss.php#L643-L692)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/init/?output_format=md#related)󠁿

| Used by | Description | 
| [fetch_rss()](https://developer.wordpress.org/reference/functions/fetch_rss/)`wp-includes/rss.php` |

Build Magpie object based on RSS from URL.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/init/?output_format=md#changelog)󠁿

| Version | Description | 
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Finit%2F)
before being able to contribute a note or feedback.