Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Plugin Name: My Plugin
* Plugin Description: Settings API Demo
*/
add_action( 'admin_menu', 'my_admin_menu' );
function my_admin_menu() {
add_options_page( 'My Plugin', 'My Plugin', 'manage_options', 'my-plugin', 'my_options_page' );
}
@bradmkjr
bradmkjr / require-acf.php
Last active October 9, 2018 17:55
Require ACF
<?php
/*** Require ACF plugin ***/
//Check if ACf exists on plugin activation
register_activation_hook( __FILE__, 'acf_plugin_activation' );
function acf_plugin_activation(){
// Require ACF or ACF Pro plugin
if ( ( !is_plugin_active( 'advanced-custom-fields/acf.php' ) && !is_plugin_active( 'advanced-custom-fields-pro/acf.php' ) ) and current_user_can( 'activate_plugins' ) ) {
// Stop activation redirect and show error