WP Query – Can’t get posts with specific taxonomy

It appears that you’re attempting to add a function to the init action hook from within the function you’re trying to add.

Your code is doing this:

function portalp_custom_taxonomies() {
    // ...
    add_action( 'init', 'portalp_custom_taxonomies' );
    // ...
}

…when it needs to do this:

function portalp_custom_taxonomies() {
    // ...
}
add_action( 'init', 'portalp_custom_taxonomies' );

As presented, the portalp_custom_taxonomies() function will not run (unless you’re calling it somewhere else) and so the taxonomies inside it aren’t getting registered.

tech