error link category to wordpress


i have POST and category and i have ep

i want get link POST in the post ep


// Get BG
foreach (get_the_category() as $category) {
    if ($category->name != 'ep') {
        $mycategory = $category->name;
        $mycategoryID = $category->term_id;

        // Do What I said
        global $wpdb;
        $postID = $wpdb->get_row("SELECT * FROM demo_posts WHERE post_title = '" . $mycategory . "' ");
        $mycategory_link = get_permalink( $postID->ID );


$ActiveepID = get_the_ID();

<h3><?php the_title();?> | <a href="<?php echo esc_url($mycategory_link);?>"><?php echo $mycategory;?></a></h3>

Sometimes it brings the correct link, and most of the time I do not know the cause of the error

This Link error

This Link true

and sorry for my bad language


>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="">

error link category to wordpress</a>
user4158643 6 months 0 Answers 65 views 0

Leave an answer