Arme este script, sin embargo tengo problemas cuando declaro:
include_once ("../../../../wp-config.php");
include_once ("../../../../wp-load.php");
include_once ("../../../../wp-includes/wp-db.php");
ERROR:
Código PHP:
Ver originalDeprecated
: Function set_magic_quotes_runtime() is deprecated in
/var/www
/tuseguridad
/wp
-settings
.php on line
32 Warning
: array_filter() expects parameter
1 to be
array, integer given in
/var/www
/tuseguridad
/wp
-includes
/post
.php on line
2464
Código PHP:
Ver original<pre>
function array_empty($mixed) {
foreach ($mixed as $value) {
if (!array_empty($value)) {
return false;
}
}
}
elseif (!empty($mixed)) { return false;
}
return true;
}
?>
</pre>
<?php
if (isset($_POST['submit'])) { if (!array_empty($_POST['sos']['data'])) {
// DECLARO VARIABLES
$problema = $_POST['sos']['data'][0];
$descripcion = $_POST['sos']['data'][1];
$fecha = $_POST['sos']['data'][2];
$hora = $_POST['sos']['data'][3] . ":" . $_POST['sos']['data'][4] . " " . $_POST['sos']['data'][5];
//$min = $_POST['sos']['data'][4];
//$time = $_POST['sos']['data'][5];
$lugar = $_POST['sos']['data'][6];
$nombre = $_POST['sos']['data'][7];
$correo = $_POST['sos']['data'][8];
include_once ("../../../../wp-config.php");
include_once ("../../../../wp-load.php");
include_once ("../../../../wp-includes/wp-db.php");
'menu_order' => 0,
'comment_status' => 'open',
'ping_status' => get_option('default_ping_status'),
'pinged' => '',
'post_author' => 1,
'post_category' => 7,
'post_content' => $descripcion,
'post_date' => $hora,
'post_date_gmt' => '',
'post_excerpt' => '',
'post_name' => '',
'post_parent' => 0,
'post_password' => '',
'post_status' => 'publish',
'post_title' => $problema,
'post_type' => 'post',
'tags_input' => '',
'to_ping' => '',
'tax_input' => '',
);
$the_post_id = wp_insert_post($post);
if ($the_post_id) {
update_post_meta( $the_post_id, 'autor_sos', $nombre );
update_post_meta( $the_post_id, 'fecha_sos', $fecha );
update_post_meta( $the_post_id, 'hora_sos', $hora );
update_post_meta( $the_post_id, 'lugar_sos', $lugar );
update_post_meta( $the_post_id, 'mail_sos', $correo );
}
} else { echo "Vacío"; } //Complete todos los campos
} else { echo "Ausente"; } //Muestro el Formulario y complete campos
?>
APARENTEMENTE YA LO HE SOLUCINADO.
Aquí el error:
'post_category' => 7, deberia ir 'post_category' => array(7,),
Cualquier cosa comento.