0

I've added my shortcode to a Wordpress page and it appears that the shortcode doesn't run unless the page is viewed by someone logged into an account. Here's the code I have so far:

<?php
/*
Plugin Name: MGC
Description: A plugin to integrate software
Author: Mike Grossman
Version: 0.1
*/

require_once(dirname(__FILE__) . '/aweber_api/aweber_api.php');
require_once( dirname( __FILE__ ) . '/wlm_api/class-api-methods.php' );
require_once(dirname(__FILE__) . '/wlm_api/wlmapiclass.php');

$member_registration_results = array();

add_action('admin_menu', 'mgc_plugin_setup_menu'); //load menu bar on the admin panela and run the function 

function mgc_plugin_setup_menu(){

    add_menu_page( 'MGC Plugin Page', 'MGC Plugin', 'manage_options', 'mgc-plugin', 'mgc_page_output'); 
}

function mgc_page_output(){

echo "MGC Plugin Activated!";
}

//Capture the $_POST data

function wpd_post_parse() {

    $string = 'wp hook: ' . var_dump($_POST) . "\r\n";

    $fileName = dirname(__FILE__) . '/log.txt';     

    file_put_contents($fileName, $string, FILE_APPEND | LOCK_EX);

}

function mgc_init(){

   $htmlStr = 'Hello World!' . "\r\n";

   $fileName = dirname(__FILE__) . '/log.txt';

   file_put_contents($fileName, $htmlStr, FILE_APPEND | LOCK_EX);

   //do_action( 'wpd_post_parse' );

}

//add_action( 'parse_request', 'wpd_post_parse' );

add_shortcode('mgc','mgc_init'); //put this shortcode [mgc] on page in Wordpress 
?>
  • 1
    Clear your browser cache and try again. – Fayaz Mar 10 '17 at 22:39
0

This issue was resolved by clearing the browser cache and using Chrome incognito mode when necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.