• I’m writing a plugin and want to check if a post type has a view page.

    I’ve tried using the permalink for the post but the ACF edit page still has a permalink even though it does nothing.

    I’ve also tried looking for the existence of the view button in the post list or admin bar but can’t seem to work out how to access the info.

    Is there a way to check if $actions[‘view’] exists or has been removed? or is there a better way to handle this?

Viewing 1 replies (of 1 total)
  • Thread Starter launchinteractive

    (@launchinteractive)

    My plugin is now live here: https://www.ads-software.com/plugins/publish-view/

    However I’m not currently checking for the existence of a view page. I just added an if statement so that ACF worked. This is my code:

    function publish_view_submitbox_start(){
    	global $post;
    	global $wp_version;
    
    	if($post->post_type != 'acf') {
    
    		if($post->post_status == 'auto-draft' || $post->post_status == 'draft') {
    			submit_button('','primary','publish',false, array('onclick'=>"jQuery(this).after('<input type=\"hidden\" name=\"publishview\" value=\"Y\" />')",'title'=>'Publish & View','id'=>'publishview'));
    		} else if($post->post_status == 'publish') {
    			submit_button('','primary','publish',false, array('onclick'=>"jQuery(this).after('<input type=\"hidden\" name=\"publishview\" value=\"Y\" />')",'title'=>'Update & View','id'=>'publishview'));
    		}
    	}
    }

    Note the ACF if statement. I would like to avoid being so specific and detect if I should output anything. Any help would be appreciated!

Viewing 1 replies (of 1 total)
  • The topic ‘disable plugin for post type without a view page’ is closed to new replies.