• Resolved allm

    (@realblueorange)


    And another question…

    I’ve noticed that a custom post with private information (dashboard only) has SEO settings for every post. That looks like a bug. And in the dashboard screen for that custom post there is a SEO column with only “TGDGIFA”, so no colors. I guess that that column also doesn’t need to be there.

    I do notice that the entries don’t end up in the sitemap. So that looks fine.

    Can you tell me under what circumstances the SEO settings are added to custom posts? Can you tell me under what circumstances custom posts are added to the sitemap? Or can I find more about that in the documentation?

    I have other websites with other types of custom posts and will check them later.

    https://www.ads-software.com/plugins/autodescription/

Viewing 3 replies - 16 through 18 (of 18 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    I confirmed the bug.

    It’s because it’s passing the $post_type without checking if it’s public.
    1. Inpost Class
    2. Detect Class

    The check lies in get_current_post_type(), I think I should move that :).
    This also accounts for The SEO Bar.

    I’ll update with a GitHub commit once it’s ready. Cheers!

    Plugin Author Sybre Waaijer

    (@cybr)

    Refactored the function for 2.6.2. The previous one (get_current_post_type) has been deprecated.

    /**
     * Returns Post Type from current screen and checks if this plugin may use it.
     *
     * @param bool $public Whether to only get Public Post types.
     * @param string $post_type Optional. The post type to check.
     *
     * @since 2.6.0
     * @staticvar string $cache
     *
     * @return bool|string The Allowed Post Type.
     */
    public function get_supported_post_type( $public = true, $post_type = '' ) {
    
    	if ( empty( $post_type ) ) {
    		global $current_screen;
    
    		if ( isset( $current_screen->post_type ) ) {
    			$post_type = $current_screen->post_type;
    		} else {
    			return false;
    		}
    	}
    
    	static $cache = array();
    
    	if ( isset( $cache[$public][$post_type] ) )
    		return $cache[$public][$post_type];
    
    	$object = get_post_type_object( $post_type );
    
    	if ( isset( $object->_builtin ) && false === $object->_builtin )
    		if ( isset( $object->rewrite ) && false === $object->rewrite )
    			$post_type = false;
    
    	if ( $post_type && $public )
    		if ( isset( $object->public ) && ! $object->public )
    			$post_type = false;
    
    	//* No post type has been found.
    	if ( empty( $post_type ) )
    		return $cache[$public][$post_type] = false;
    
    	return $cache[$public][$post_type] = $post_type;
    }

    Enjoy! ??

    Thread Starter allm

    (@realblueorange)

    Great! I’ll check it as soon as 2.6.2 is out.

    Have a great day. And… take some time off, enjoy some tea, have some cake… Life is wonderful! ??

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘custom posts’ is closed to new replies.