$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>updates - Is the root index.php file part of the Core?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

updates - Is the root index.php file part of the Core?

matteradmin8PV0评论

The contents of the /index.php is as follows:

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );

If I make any changes in this file, then do a Wordpress Update, will the contents of this file be replaced? I've not been able to find any references online for this file, only Wordpress' /wp-includes and /wp-admin folders.

I don't have access to the php.ini file and want to change the session cookie lifetime setting by adding the following code:

    $seconds = 31557600; //1 year
    ini_set('session.gc_maxlifetime', $seconds);
    ini_set('session.cookie_lifetime', $seconds);

but don't want to add it to a file that potentially could be overridden in a couple of months time.

The contents of the /index.php is as follows:

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );

If I make any changes in this file, then do a Wordpress Update, will the contents of this file be replaced? I've not been able to find any references online for this file, only Wordpress' /wp-includes and /wp-admin folders.

I don't have access to the php.ini file and want to change the session cookie lifetime setting by adding the following code:

    $seconds = 31557600; //1 year
    ini_set('session.gc_maxlifetime', $seconds);
    ini_set('session.cookie_lifetime', $seconds);

but don't want to add it to a file that potentially could be overridden in a couple of months time.

Share Improve this question asked Mar 18, 2019 at 16:44 Richard Parnaby-KingRichard Parnaby-King 1158 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 4

Yes, index.php is part of core and is liable to be overwritten.

In fact, if you look at the process to manually update WordPress, step 7 is:

Upload all new loose files from the root directory of the new version to your existing WordPress root directory

That may include index.php.

You can put custom PHP code in a custom plugin or theme. If using a pre-built theme, first create a child theme and then put your code in that child theme's functions.php.

If you run PHP as Apache module you can set php.ini values in .htaccess:

AllowOverride Options
php_value session.gc_maxlifetime 31557600
php_value session.cookie_lifetime 31557600
Post a comment

comment list (0)

  1. No comments so far