Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions lib/medium-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public static function init() {
add_action("add_meta_boxes_post", array("Medium_Admin", "add_meta_boxes_post"));

add_action("save_post", array("Medium_Admin", "save_post"), 10, 2);
add_action("publish_post", array("Medium_Admin", "save_post"), 10, 2);
}

// Actions and hooks.
Expand Down Expand Up @@ -765,12 +766,9 @@ public static function cross_post($post, $medium_post, $medium_user) {
$tags = array_values(array_unique(array_merge($slugs, $tags)));

// pull in categories as tags
$categories = wp_get_the_category($post->ID);
$cats = array();
foreach($categories as $category){
$cats[] = $category->name;
}
$tags = array_values(array_unique(array_merge($cats, $tags)));
$args = array('fields' => 'names'); // @see wp_get_post_categories() $args ref to wp_get_object_terms()
$categories_name = wp_get_post_categories($post->ID, $args);
$tags = array_values(array_unique(array_merge($categories_name, $tags)));

if (class_exists('CoAuthors_Guest_Authors')) {
// Handle guest-authors if the CoAuthors Plus plugin is installed.
Expand Down
3 changes: 2 additions & 1 deletion medium.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
define("MEDIUM_PLUGIN_DIR", plugin_dir_path(__FILE__));
define("MEDIUM_PLUGIN_URL", plugin_dir_url(__FILE__));

if (is_admin()) {
if (is_admin() or
(defined ('DOING_CRON') and DOING_CRON)) {
require_once(MEDIUM_PLUGIN_DIR . "lib/medium-admin.php");
add_action("init", array("Medium_Admin", "init"));
} else {
Expand Down