Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

dazzlesoftware on "plugin only works after I change priority"

$
0
0

Hello I seem to have issue well in my plugin it setup post types via config array which is attached via filter

add_action( 'init', 'headlines_register_post_type');
function headlines_register_post_type()
{
	$post_types = apply_filters( 'headlines_post_types', array() );
	foreach ( $post_types as $post_type )
	{
		new Headlines_Post_Type( $post_type );
	}
}

but as soon as I call my class function for

add_action( 'init', array( $this, 'register_post_type' ) );

it stops working but if I change the priory for

add_action( 'init', 'headlines_register_post_type', 5);

it works how can I use the default priory ? as I sure this is not good way to code plugins changing the priory as it could conflict other plugins maybe ...

Stephen


Viewing all articles
Browse latest Browse all 8245

Trending Articles