Plugin Directory

Changeset 3205703


Ignore:
Timestamp:
12/10/2024 02:10:43 PM (14 months ago)
Author:
wpinternallink2024
Message:

Fix bug

Location:
laci-link-cluster
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • laci-link-cluster/tags/1.0.4/includes/Controllers/MetaBoxMainCategoryController.php

    r3202824 r3205703  
    158158        update_post_meta( $post_id, 'laci_main_category_id', $main_category );
    159159
    160         $outbound_links = array_merge( InternalLinksController::get_outbound_internal_links( $post_id ), WPILCustomTableManager::get_meta_value( $post_id, 'outbound_links' ) );
     160        // Fetch outbound links
     161        $outbound_internal_links = InternalLinksController::get_outbound_internal_links( $post_id );
     162        $meta_outbound_links = WPILCustomTableManager::get_meta_value( $post_id, 'outbound_links' );
     163
     164        // Ensure both are arrays
     165        if ( ! is_array( $outbound_internal_links ) ) {
     166            $outbound_internal_links = [];
     167        }
     168
     169        if ( ! is_array( $meta_outbound_links ) ) {
     170            $meta_outbound_links = [];
     171        }
     172
     173        // Merge the arrays
     174        $outbound_links = array_merge( $outbound_internal_links, $meta_outbound_links );
    161175
    162176        $unique_outbound_links = array_map(
  • laci-link-cluster/trunk/includes/Controllers/MetaBoxMainCategoryController.php

    r3166563 r3205703  
    158158        update_post_meta( $post_id, 'laci_main_category_id', $main_category );
    159159
    160         $outbound_links = array_merge( InternalLinksController::get_outbound_internal_links( $post_id ), WPILCustomTableManager::get_meta_value( $post_id, 'outbound_links' ) );
     160        // Fetch outbound links
     161        $outbound_internal_links = InternalLinksController::get_outbound_internal_links( $post_id );
     162        $meta_outbound_links = WPILCustomTableManager::get_meta_value( $post_id, 'outbound_links' );
     163
     164        // Ensure both are arrays
     165        if ( ! is_array( $outbound_internal_links ) ) {
     166            $outbound_internal_links = [];
     167        }
     168
     169        if ( ! is_array( $meta_outbound_links ) ) {
     170            $meta_outbound_links = [];
     171        }
     172
     173        // Merge the arrays
     174        $outbound_links = array_merge( $outbound_internal_links, $meta_outbound_links );
    161175
    162176        $unique_outbound_links = array_map(
Note: See TracChangeset for help on using the changeset viewer.