call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members

The parameters are fairly wrong here: add_options_page( ‘Theme Options’, ‘Theme Options’, ‘administrator’, __FILE__, array(‘KD_Options’), ‘display_options_page’ ); Because you are within a Class, the callback needs to be array( $this, ‘display_options_page’ ) and not just a function name. You use that array format for WP callbacks within classes so that they are correctly referenced. However, add_options_page … Read more

how to Include json manifest file in wp plugin

Include this in you plugin add_action( ‘wp_head’, ‘inc_manifest_link’ ); // Creates the link tag function inc_manifest_link() { echo ‘<link rel=”manifest” href=”https://wordpress.stackexchange.com/manifest.json”>’; } what we are doing here is adding a hook to wp_head action.

manage_posts_custom_column, showing serial number using increment in loop

This code will add an Index value to each post which is determined by $wp_query->current_post, the number of posts per page, and the current page being viewed. add_filter( ‘manage_posts_columns’, ‘wpse240648_manage_posts_columns_index’); function wpse240648_manage_posts_columns_index($columns) { $columns[‘index’] = __( ‘Index’, ‘your-text-domain’ ); return $columns; } add_action( ‘manage_posts_custom_column’, ‘wpse240648_manage_posts_custom_column_index’, 10, 3 ); function wpse240648_manage_posts_custom_column_index( $column, $post_id ) { if … Read more

How to add class in plugin only for network site?

How are you invoking ngob_sitelist_slug? I’m gonna guess that you are doing something like $my_class = new ngob_sitelist_slug;. Doing it this way would require that your class have a constructor. if it doesn’t, you’ll get an error. You could still call your class methods statically: $my_thing = ngob_sitelist_slug::my_method(); Though technically you should add the static … Read more

Do my defines need to be unique?

Yes they do, the more interesting question is why do you use define instead of const? Take a look here: define() vs const. The only situation in which you should use a define over const is if you want the user to be able to override your defines in wp-config.php. Obviously things like minimum php … Read more