wordpress edit archive page code example
Example: wordpress change posts archive
add_action('init', 'post_slug_rewrite');
function post_slug_rewrite()
{
$args = objectToArray( get_post_type_object('post') );
$args['has_archive'] = 'blog';
$args['rewrite'] = array(
'slug' => 'blog',
'with_front' => FALSE,
);
register_post_type('post', $args);
}
function objectToArray( $object )
{
if( !is_object( $object ) && !is_array( $object ) )
{
return $object;
}
if( is_object( $object ) )
{
$object = get_object_vars( $object );
}
return array_map('objectToArray', $object);
}