Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter jet89

    (@jet89)

    thanks for the notes, i implemented this as well as using wp_get_post_terms instead and the results are as desired!

    Thank you for all the help everyone!

    Thread Starter jet89

    (@jet89)

    So the current workflow is as follows. I have one function that will create child posts using wp_insert_post and the ‘save_post’ hook when saved prioritized before the included function. After that, I call this function to assign the terms to those child pages.

    I updated the code to accommodate the the variable issue but am still getting the same results.

    It looks like I am able to get all the children pages and apply the term list however the term list variable returns no values.

    revised code below:

    <?php
    add_action(‘save_post’, ‘assign_parent_terms’,10);

    function assign_parent_terms($post_id){
    global $currentpost;
    $currentpost = get_post( $post_id );

    if(isset($currentpost) && $currentpost->post_type != ‘campaign’){
    return $post_id;}

    // CREATE POST CONDITION
    if ( !wp_is_post_revision( $post_id )
    && ‘campaign’ == get_post_type( $post_id )
    && ‘auto-draft’ != get_post_status( $post_id ) ) {
    $currentpost = get_post( $post_id );
    // get all assigned terms

    $term_list = wp_get_object_terms( $currentpost->ID, ‘brand’);

    //$term_list = wp_get_post_terms( $post->ID, ‘brand’);
    $getchilargs = array(
    ‘post_parent’ => $currentpost->ID,
    ‘post_type’ => ‘campaign’,
    ‘numberposts’ => -1,
    ‘post_status’ => ‘any’
    );
    $children = get_children( $getchilargs );

    if(!empty($children)){
    foreach ($children as $child){
    $childID = $child->ID;
    //$childparent = $child->parent;
    //$term_list = $post->post_name;
    wp_set_object_terms($childID, $term_list, ‘brand’);
    }
    }

    }
    }
    ?>

    • This reply was modified 6 years ago by jet89.
    • This reply was modified 6 years ago by jet89.
    Thread Starter jet89

    (@jet89)

    Is there a login redirect plugin and or custom log in page plugin that plays nice with this plugin?

    Thread Starter jet89

    (@jet89)

    Looks like this error only happens for unauthorized users now. If I want a page to be fully public, should i make sure it isn’t included in any rule?

    Thread Starter jet89

    (@jet89)

    Quick Update: I tried deactivating plugins again and after a few tries, the problem fixed itself again. Is there a more permanent fix for this or is this purely a plugin conflict issue? This doesn’t seem to play well with any login centric/content access plugins.

Viewing 5 replies - 1 through 5 (of 5 total)