Skip to content

Instantly share code, notes, and snippets.

@WadeTheFade
WadeTheFade / gist:c2958e465ab7b3a5a0a109ef255144c2
Last active February 8, 2021 18:31
List being overwritten by last value
var sentFiles = new List<FileTrack>();
foreach (var destination in model.Destinations)
{
sentFiles.AddRange(_mover(destination.LocationType).ToDestination(destination, processLog, fileTracker, model.StagingLocation));
}
//EXPECTED VALUES HAVE BEEN OVERWROTE WITH LAST VALUE ADDED VIA ADD()
fileTracker.Sent = sentFiles;
return fileTracker;
@WadeTheFade
WadeTheFade / Edit
Created October 4, 2018 01:04
class-form-hooks.php
if ( ! $editing ) {
$question_args['post_type'] = 'question';
//$question_args["post_status"] = "draft";
$post_id = wp_insert_post( $question_args, true );
$postToTransition = get_post( $post_id );
clean_post_cache($postToTransition->ID);
//Need to update post via $WPDB or a method here
//anspress()->query->updatePost("publish", $postToTransition);
wp_transition_post_status( "publish", "draft", $postToTransition);
@WadeTheFade
WadeTheFade / ORIGINALcategories.php
Last active July 31, 2018 12:00
Currently edited for question_category
<?php
/**
* Add category support in AnsPress questions.
*
* @author Rahul Aryan <support@anspress.io>
* @copyright 2014 AnsPress.io & Rahul Aryan
* @license GPL-3.0+ https://www.gnu.org/licenses/gpl-3.0.txt
* @link https://anspress.io
* @package AnsPress
* @subpackage Categories Addon