Updates the rewrite rules for the posttype
@param  string $postType
@param  array $args
@return void
491806
public function updateRewrite(string $postType, $args)
    {
        global $wp_post_types, $wp_rewrite;

        // Bail if page not set
        $pageForPostType = get_option('page_for_' . $postType);
        if (!$pageForPostType) {
            return;
        }

        // Bail if page not published or private
        $postStatus = get_post_status($pageForPostType);
        if (!in_array($postStatus, array('publish', 'private'))) {
            return;
        }

        // Get original rewrite rule
        $args->rewrite = (array) $args->rewrite;
        $oldRewrite = isset($args->rewrite['slug']) ? $args->rewrite['slug'] : $postType;
        \WpPageForPostType\Settings::$originalSlugs[$postType] = $oldRewrite;

        // Get the new slug
        $newSlug = $this->getPageSlug($pageForPostType);

        $args->rewrite     = wp_parse_args(array('slug' => $newSlug), $args->rewrite);
        $args->has_archive = $newSlug;

        // Rebuild rewrite rules
        $this->rebuildRewriteRules($postType, $args, $oldRewrite);

        // Update global
        $wp_post_types[$postType] = $args;
    }
761978
public function posttype()
    {
        $this->setClassname($this->getArgument(0));

        $name = Str::snake($this->getClassname());

        $this->generateClass('Posttypes', 'posttype.stub', [
            'classname' => $this->getClassname(),
            'slug' => $this->getOption('slug', $name),
            'rewrite_slug' => $this->getOption('slug', Str::slug($name)),
        ]);
    }
755488
public function handleUpdate(Args $args)
    {
        $flags = $args->isOptionSet('force')
            ? DiscoveryManager::OVERRIDE | DiscoveryManager::IGNORE_TYPE_NOT_FOUND
                | DiscoveryManager::IGNORE_TYPE_NOT_ENABLED
            : DiscoveryManager::OVERRIDE;

        $descriptorToUpdate = $this->getBindingByUuidPrefix($args->getArgument('uuid'));
        $bindingToUpdate = $descriptorToUpdate->getBinding();

        if (!$descriptorToUpdate->getContainingModule() instanceof RootModule) {
            throw new RuntimeException(sprintf(
                'Can only update bindings in the module "%s".',
                $this->modules->getRootModuleName()
            ));
        }

        if ($bindingToUpdate instanceof ResourceBinding) {
            $updatedBinding = $this->getUpdatedResourceBinding($args, $bindingToUpdate);
        } elseif ($bindingToUpdate instanceof ClassBinding) {
            $updatedBinding = $this->getUpdatedClassBinding($args, $bindingToUpdate);
        } else {
            throw new RuntimeException(sprintf(
                'Cannot update bindings of type %s.',
                get_class($bindingToUpdate)
            ));
        }

        $updatedDescriptor = new BindingDescriptor($updatedBinding);

        if ($this->bindingsEqual($descriptorToUpdate, $updatedDescriptor)) {
            throw new RuntimeException('Nothing to update.');
        }

        $this->discoveryManager->addRootBindingDescriptor($updatedDescriptor, $flags);

        return 0;
    }
648860
public function addRedirect($postValues)
    {
        $redirectObject = RedirectsFactory::createRedirectFromPostValues($postValues);
        $redirects = $this->repository->redirects;
        $redirects[] = $redirectObject;
        $this->repository->redirects = $redirects;
        $this->save();
    }
809948
public function update( array $args ) {

		/**
		 * @var \WP_Error|array $response
		 * @var string          $context
		 * @var string          $class
		 */
		list( $response, $context, $class ) = $args;
		$http_args = isset( $args[ 3 ] ) ? $args[ 3 ] : [];
		$url       = isset( $args[ 4 ] ) ? $args[ 4 ] : '';

		if ( $this->is_error( $response, (array) $http_args ) ) {
			return $this->log_http_error( $response, $context, $class, $http_args, $url );
		}

		if ( $this->is_cron( $response, $url ) ) {
			return $this->log_cron( $response, $context, $class, $http_args, $url );
		}

		return new NullLog();
	}
1108498
public function setArguments(array $args): PostTypeInterface
    {
        $this->args = array_merge($this->args, $args);

        return $this;
    }
574143
public function add($typeName, $args)
	{
		// set default
		$args = array_merge_recursive(array(
			'public' => true,
			'supports' => array(
				'title',
				'editor',
				'thumbnail',
				'revisions',
			),
			'has_archive' => true,
		), $args);

		$this->posttypes[$typeName] = $args;

		return true;
	}
1034947
public function afterUpdate(&$args) {
        $model      = $args[0];
        $where      = $args[3];

        $primaryKey = $model->extractPrimaryKey($where);
        $id         = $primaryKey['id'];

        $this->afterSave($model, $id);
    }
1298412
public function update( array $args ) {

		$wp = $args ? reset( $args ) : NULL;

		if ( ! $wp instanceof \WP ) {
			return new NullLog();
		}

		$error = [];
		isset( $wp->query_vars[ 'error' ] ) and $error[] = $wp->query_vars[ 'error' ];
		is_404() and $error[] = '404 Page not found';

		if ( empty( $error ) ) {
			return new NullLog();
		}

		$url     = filter_var( add_query_arg( [] ), FILTER_SANITIZE_URL );
		$message = "Error on frontend request for url {$url}.";
		$context = [
			'error'        => $error,
			'query_vars'   => $wp->query_vars,
			'matched_rule' => $wp->matched_rule,
		];

		return new Debug( $message, Channels::HTTP, $context );
	}
724243
private static function is_rewrite_supported_by( $post_type ) {
		$post_type_object = get_post_type_object( $post_type );
		if ( false === $post_type_object->rewrite ) {
			$support = false;
		} else {
			$support = true;
		}

		/**
		 * Filters support CPTP for custom post type.
		 *
		 * @since 3.2.0
		 *
		 * @param bool $support support CPTP.
		 */
		$support = apply_filters( "CPTP_is_rewrite_supported_by_${post_type}", $support );

		/**
		 * Filters support CPTP for custom post type.
		 *
		 * @since 3.2.0
		 *
		 * @param bool $support support CPTP.
		 * @param string $post_type post type name.
		 */
		return apply_filters( 'CPTP_is_rewrite_supported', $support, $post_type );
	}
250936
public function posts($posttype = null, $arguments = [])
    {
        return $this->model->postsWith($this, $posttype, $arguments);
    }
1069264
final protected function initPostTypesTrait() {
		add_action("init", function () {
			$postTypes = $this->getPostTypes();
			foreach ($postTypes as $postType) {
				$this->registerPostType($postType);
			}
		});
	}
284338
public function update(Post $post, UpdatePostRequest $request)
    {
        $this->authorize(PostsPolicy::PERMISSION_UPDATE);

        $post->updateOne($request->getValidatedData());

        $this->transNotification('updated', ['title' => $post->title], $post->toArray());

        return redirect()->route('admin::blog.posts.show', [$post]);
    }
442561
public function postTypeSettings()
    {
        // Add section
        add_settings_section(
            'olympus-permalinks',
            Translate::t('posttypehook.custom_permalinks'),
            [&$this,'postTypeSettingTitle'],
            'permalink'
        );

        // Flush all rewrite rules
        if (isset($_POST['flushpermalink'])) {
            flush_rewrite_rules();
        }

        // Special case: do not change post/page component
        if (in_array($this->slug, $this->reserved_slugs)) {
            return false;
        }

        // Option
        $opt = 'permalink_structure_'.$this->slug;

        // Check POST
        if (isset($_POST[$opt])) {
            $value = $_POST[$opt];
            Option::set($opt, $value);
        } else {
            $value = Option::get($opt, '/%'.$this->slug.'%-%post_id%');
        }

        // Define metabox title
        $title = $this->name.' <code>%'.$this->slug.'%</code>';

        // Add fields
        add_settings_field(
            $opt,
            $title,
            [$this, 'postTypeSettingFunc'],
            'permalink',
            'olympus-permalinks',
            [
                'name' => $opt,
                'value' => $value,
            ]
        );

        return true;
    }
388555
def _change_kind(self, post_uid):
        '''
        
        '''

        post_data = self.get_post_data()

        logger.info('admin post update: {0}'.format(post_data))

        MPost.update_misc(post_uid, kind=post_data['kcat'])
        # self.update_category(post_uid)

        update_category(post_uid, post_data)
        self.redirect('/{0}/{1}'.format(router_post[post_data['kcat']], post_uid))
637120
public function removeUnwantedModuleMetaboxes($postType)
    {
        $publicPostTypes = array_keys(\Municipio\Helper\PostType::getPublic());
        $publicPostTypes[] = 'page';

        if (!in_array($postType, $publicPostTypes)) {
            // Navigation settings
            remove_meta_box('acf-group_56d83cff12bb3', $postType, 'side');

            // Display settings
            remove_meta_box('acf-group_56c33cf1470dc', $postType, 'side');
        }
    }
1234736
public function update( $args, $assoc_args ) {
		list( $id, $domain ) = $args;

		$defaults   = array(
			'path' => '',
		);
		$assoc_args = wp_parse_args( $assoc_args, $defaults );

		$network_id = update_network( $id, $domain, $assoc_args['path'] );

		if ( is_wp_error( $network_id ) ) {
			WP_CLI::error( $network_id );
		}

		WP_CLI::success( sprintf( 'Updated network %d.', $id ) );
	}