there’s a error in this theme,
http://www.mafiashare.net/download/sound-rock-music-band-wordpress-theme/
when I try to activate it, this show up
( ! ) SCREAM: Error suppression ignored for
( ! ) Fatal error: Cannot re-assign auto-global variable _POST in C:wampwwwwebwp-contentthemessoundrockfunctions.php on line 48
Call Stack
# Time Memory Function Location
1 0.0014 364560 {main}( ) ..themes.php:0
2 0.0043 433520 require_once( 'C:wampwwwwebwp-adminadmin.php' ) ..themes.php:10
3 0.0048 451648 require_once( 'C:wampwwwwebwp-load.php' ) ..admin.php:30
4 0.0052 463256 require_once( 'C:wampwwwwebwp-config.php' ) ..wp-load.php:29
5 0.0061 553312 require_once( 'C:wampwwwwebwp-settings.php' ) ..wp-config.php:90
so in functions.php on line 48, I removed this code, then the theme is working, but I want to why it’s throwing an error?
function events_meta_save($_POST, $post_id) {
global $wpdb;
if ( empty($_POST["event_social_sharing"]) ) $_POST["event_social_sharing"] = "";
if ( empty($_POST["event_start_time"]) ) $_POST["event_start_time"] = "";
if ( empty($_POST["event_end_time"]) ) $_POST["event_end_time"] = "";
if ( empty($_POST["event_all_day"]) ) $_POST["event_all_day"] = "";
if ( empty($_POST["event_booking_url"]) ) $_POST["event_booking_url"] = "";
if ( empty($_POST["event_address"]) ) $_POST["event_address"] = "";
$sxe = new SimpleXMLElement("<event></event>");
$sxe->addChild('event_social_sharing', $_POST["event_social_sharing"] );
$sxe->addChild('event_start_time', $_POST["event_start_time"] );
$sxe->addChild('event_end_time', $_POST["event_end_time"] );
$sxe->addChild('event_all_day', $_POST["event_all_day"] );
$sxe->addChild('event_booking_url', $_POST["event_booking_url"] );
$sxe->addChild('event_address', $_POST["event_address"] );
$sxe = save_layout_xml($sxe);
update_post_meta( $post_id, 'cs_event_meta', $sxe->asXML() );
}
Replace
with
Do not forget to replace ALL
$_POST
inside the condition with$_my_post
or any other name u likeReason, as written in other answers:
. Doing so attempts to re-assign the variable in the symbol table.
Regard this as a saved keyword of the language. Putting it in a function signature is like defining new variable using a keyword of the language as the variable name.
@snjflame, you don’t need to use
$_POST
as a parameter of a function, because it is a superglobal variable. You can’t redefine$_POST
variables; you need to define a “handler
” for the$_POST
variable at the beginning of your function and use it below.For example: