• Resolved jmtmurphey

    (@jmtmurphey)


    Can I use this plugin to execute WordPress (and 3rd Party Plugin) actions and filters using php?

    For example, executing a php snippet to process data when a gravity form is posted. Actions and filters are usually put in the functions.php file. I can create a php code block with the same code I would put in functions.php but it doesn’t get executed.

    Example: The following code does not get executed when I add it as a php block in your plugin.

    add_action( ‘gform_pre_submission_2’, ‘pre_submission_handler’ );
    function pre_submission_handler( $form ) {
    //Set Display Date
    $event_date = rgpost( ‘input_8’ );
    echo $event_date;
    $display_date = DateTime::createFromFormat(‘m/d/Y’,$event_date)->format(‘F j, Y’);
    echo $display_date;
    $_POST[‘input_9’] = $display_date;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author wipeoutmedia

    (@wipeoutmedia)

    Hi there,

    Thanks for your support question and sorry for the delay in getting back to you. By any chance, did you manage to solve it?

    Unless you use this snippet as a CJT Code File, which can be used to wrap your code automatically inside PHP tags, you will need to add them manually within the Code Block.

    Regards,
    Damian

    Thread Starter jmtmurphey

    (@jmtmurphey)

    I added the php tags to the Code Block but the code never gets run. I have the same problem trying to execute any WordPress hooks and filters in a Code Block.

    For example, I want to run the following:
    <?php
    //* Add both layout and SEO settings to custom post type
    add_post_type_support( ‘article’, ‘genesis-layouts’ );
    add_post_type_support( ‘article’, ‘genesis-seo’ );
    ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WP Hooks’ is closed to new replies.