Risultati della ricerca per 'Wordpress permalink problem'
-
-
Quando provo ad accedere al mio sito web mi da il seguente errore:
/** * WordPress environment setup class. * * @package WordPress * @since 2.0.0 */ #[AllowDynamicProperties] class WP { /** * Public query variables. * * Long list of public query variables. * * @since 2.0.0 * @var string[] */ public $public_query_vars = array( ‘m’, ‘p’, ‘posts’, ‘w’, ‘cat’, ‘withcomments’, ‘withoutcomments’, ‘s’, ‘search’, ‘exact’, ‘sentence’, ‘calendar’, ‘page’, ‘paged’, ‘more’, ‘tb’, ‘pb’, ‘author’, ‘order’, ‘orderby’, ‘year’, ‘monthnum’, ‘day’, ‘hour’, ‘minute’, ‘second’, ‘name’, ‘category_name’, ‘tag’, ‘feed’, ‘author_name’, ‘pagename’, ‘page_id’, ‘error’, ‘attachment’, ‘attachment_id’, ‘subpost’, ‘subpost_id’, ‘preview’, ‘robots’, ‘favicon’, ‘taxonomy’, ‘term’, ‘cpage’, ‘post_type’, ‘embed’ ); /** * Private query variables. * * Long list of private query variables. * * @since 2.0.0 * @var string[] */ public $private_query_vars = array( ‘offset’, ‘posts_per_page’, ‘posts_per_archive_page’, ‘showposts’, ‘nopaging’, ‘post_type’, ‘post_status’, ‘category__in’, ‘category__not_in’, ‘category__and’, ‘tag__in’, ‘tag__not_in’, ‘tag__and’, ‘tag_slug__in’, ‘tag_slug__and’, ‘tag_id’, ‘post_mime_type’, ‘perm’, ‘comments_per_page’, ‘post__in’, ‘post__not_in’, ‘post_parent’, ‘post_parent__in’, ‘post_parent__not_in’, ‘title’, ‘fields’ ); /** * Extra query variables set by the user. * * @since 2.1.0 * @var array */ public $extra_query_vars = array(); /** * Query variables for setting up the WordPress Query Loop. * * @since 2.0.0 * @var array */ public $query_vars = array(); /** * String parsed to set the query variables. * * @since 2.0.0 * @var string */ public $query_string = ”; /** * The request path, e.g. 2015/05/06. * * @since 2.0.0 * @var string */ public $request = ”; /** * Rewrite rule the request matched. * * @since 2.0.0 * @var string */ public $matched_rule = ”; /** * Rewrite query the request matched. * * @since 2.0.0 * @var string */ public $matched_query = ”; /** * Whether already did the permalink. * * @since 2.0.0 * @var bool */ public $did_permalink = false; /** * Adds a query variable to the list of public query variables. * * @since 2.1.0 * * @param string $qv Query variable name. */ public function add_query_var( $qv ) { if ( ! in_array( $qv, $this->public_query_vars, true ) ) { $this->public_query_vars[] = $qv; } } /** * Removes a query variable from a list of public query variables. * * @since 4.5.0 * * @param string $name Query variable name. */ public function remove_query_var( $name ) { $this->public_query_vars = array_diff( $this->public_query_vars, array( $name ) ); } /** * Sets the value of a query variable. * * @since 2.3.0 * * @param string $key Query variable name. * @param mixed $value Query variable value. */ public function set_query_var( $key, $value ) { $this->query_vars[ $key ] = $value; } /** * Parses the request to find the correct WordPress query. * * Sets up the query variables based on the request. There are also many * filters and actions that can be used to further manipulate the result. * * @since 2.0.0 * @since 6.0.0 A return value was added. * * @global WP_Rewrite $wp_rewrite WordPress rewrite component. * * @param array|string $extra_query_vars Set the extra query variables. * @return bool Whether the request was parsed. */ public function parse_request( $extra_query_vars = ” ) { global $wp_rewrite; /** * Filters whether to parse the request. * * @since 3.5.0 * * @param bool $bool Whether or not to parse the request. Default true. * @param WP $wp Current WordPress environment instance. * @param array|string $extra_query_vars Extra passed query variables. */ if ( ! apply_filters( ‘do_parse_request’, true, $this, $extra_query_vars ) ) { return false; } $this->query_vars = array(); $post_type_query_vars = array(); if ( is_array( $extra_query_vars ) ) { $this->extra_query_vars = & $extra_query_vars; } elseif ( ! empty( $extra_query_vars ) ) { parse_str( $extra_query_vars, $this->extra_query_vars ); } // Process PATH_INFO, REQUEST_URI, and 404 for permalinks. // Fetch the rewrite rules. $rewrite = $wp_rewrite->wp_rewrite_rules(); if ( ! empty( $rewrite ) ) { // If we match a rewrite rule, this will be cleared. $error = ‘404’; $this->did_permalink = true; $pathinfo = isset( $_SERVER[‘PATH_INFO’] ) ? $_SERVER[‘PATH_INFO’] : ”; list( $pathinfo ) = explode( ‘?’, $pathinfo ); $pathinfo = str_replace( ‘%’, ‘%25’, $pathinfo ); list( $req_uri ) = explode( ‘?’, $_SERVER[‘REQUEST_URI’] ); $self = $_SERVER[‘PHP_SELF’]; $home_path = parse_url( home_url(), PHP_URL_PATH ); $home_path_regex = ”; if ( is_string( $home_path ) && ” !== $home_path ) { $home_path = trim( $home_path, ‘/’ ); $home_path_regex = sprintf( ‘|^%s|i’, preg_quote( $home_path, ‘|’ ) ); } /* * Trim path info from the end and the leading home path from the front. * For path info requests, this leaves us with the requesting filename, if any. * For 404 requests, this leaves us with the requested permalink. */ $req_uri = str_replace( $pathinfo, ”, $req_uri ); $req_uri = trim( $req_uri, ‘/’ ); $pathinfo = trim( $pathinfo, ‘/’ ); $self = trim( $self, ‘/’ ); if ( ! empty( $home_path_regex ) ) { $req_uri = preg_replace( $home_path_regex, ”, $req_uri ); $req_uri = trim( $req_uri, ‘/’ ); $pathinfo = preg_replace( $home_path_regex, ”, $pathinfo ); $pathinfo = trim( $pathinfo, ‘/’ ); $self = preg_replace( $home_path_regex, ”, $self ); $self = trim( $self, ‘/’ ); } // The requested permalink is in $pathinfo for path info requests and $req_uri for other requests. if ( ! empty( $pathinfo ) && ! preg_match( ‘|^.*’ . $wp_rewrite->index . ‘$|’, $pathinfo ) ) { $requested_path = $pathinfo; } else { // If the request uri is the index, blank it out so that we don’t try to match it against a rule. if ( $req_uri === $wp_rewrite->index ) { $req_uri = ”; } $requested_path = $req_uri; } $requested_file = $req_uri; $this->request = $requested_path; // Look for matches. $request_match = $requested_path; if ( empty( $request_match ) ) { // An empty request could only match against ^$ regex. if ( isset( $rewrite[‘$’] ) ) { $this->matched_rule = ‘$’; $query = $rewrite[‘$’]; $matches = array( ” ); } } else { foreach ( (array) $rewrite as $match => $query ) { // If the requested file is the anchor of the match, prepend it to the path info. if ( ! empty( $requested_file ) && str_starts_with( $match, $requested_file ) && $requested_file !== $requested_path ) { $request_match = $requested_file . ‘/’ . $requested_path; } if ( preg_match( “#^$match#”, $request_match, $matches ) || preg_match( “#^$match#”, urldecode( $request_match ), $matches ) ) { if ( $wp_rewrite->use_verbose_page_rules && preg_match( ‘/pagename=\$matches\[([0-9]+)\]/’, $query, $varmatch ) ) { // This is a verbose page match, let’s check to be sure about it. $page = get_page_by_path( $matches[ $varmatch[1] ] ); if ( ! $page ) { continue; } $post_status_obj = get_post_status_object( $page->post_status ); if ( ! $post_status_obj->public && ! $post_status_obj->protected && ! $post_status_obj->private && $post_status_obj->exclude_from_search ) { continue; } } // Got a match. $this->matched_rule = $match; break; } } } if ( ! empty( $this->matched_rule ) ) { // Trim the query of everything up to the ‘?’. $query = preg_replace( ‘!^.+\?!’, ”, $query ); // Substitute the substring matches into the query. $query = addslashes( WP_MatchesMapRegex::apply( $query, $matches ) ); $this->matched_query = $query; // Parse the query. parse_str( $query, $perma_query_vars ); // If we’re processing a 404 request, clear the error var since we found something. if ( ‘404’ === $error ) { unset( $error, $_GET[‘error’] ); } } // If req_uri is empty or if it is a request for ourself, unset error. if ( empty( $requested_path ) || $requested_file === $self || str_contains( $_SERVER[‘PHP_SELF’], ‘wp-admin/’ ) ) { unset( $error, $_GET[‘error’] ); if ( isset( $perma_query_vars ) && str_contains( $_SERVER[‘PHP_SELF’], ‘wp-admin/’ ) ) { unset( $perma_query_vars ); } $this->did_permalink = false; } } /** * Filters the query variables allowed before processing. * * Allows (publicly allowed) query vars to be added, removed, or changed prior * to executing the query. Needed to allow custom rewrite rules using your own arguments * to work, or any other custom query variables you want to be publicly available. * * @since 1.5.0 * * @param string[] $public_query_vars The array of allowed query variable names. */ $this->public_query_vars = apply_filters( ‘query_vars’, $this->public_query_vars ); foreach ( get_post_types( array(), ‘objects’ ) as $post_type => $t ) { if ( is_post_type_viewable( $t ) && $t->query_var ) { $post_type_query_vars[ $t->query_var ] = $post_type; } } foreach ( $this->public_query_vars as $wpvar ) { if ( isset( $this->extra_query_vars[ $wpvar ] ) ) { $this->query_vars[ $wpvar ] = $this->extra_query_vars[ $wpvar ]; } elseif ( isset( $_GET[ $wpvar ] ) && isset( $_POST[ $wpvar ] ) && $_GET[ $wpvar ] !== $_POST[ $wpvar ] ) { wp_die( __( ‘A variable mismatch has been detected.’ ), __( ‘Sorry, you are not allowed to view this item.’ ), 400 ); } elseif ( isset( $_POST[ $wpvar ] ) ) { $this->query_vars[ $wpvar ] = $_POST[ $wpvar ]; } elseif ( isset( $_GET[ $wpvar ] ) ) { $this->query_vars[ $wpvar ] = $_GET[ $wpvar ]; } elseif ( isset( $perma_query_vars[ $wpvar ] ) ) { $this->query_vars[ $wpvar ] = $perma_query_vars[ $wpvar ]; } if ( ! empty( $this->query_vars[ $wpvar ] ) ) { if ( ! is_array( $this->query_vars[ $wpvar ] ) ) { $this->query_vars[ $wpvar ] = (string) $this->query_vars[ $wpvar ]; } else { foreach ( $this->query_vars[ $wpvar ] as $vkey => $v ) { if ( is_scalar( $v ) ) { $this->query_vars[ $wpvar ][ $vkey ] = (string) $v; } } } if ( isset( $post_type_query_vars[ $wpvar ] ) ) { $this->query_vars[‘post_type’] = $post_type_query_vars[ $wpvar ]; $this->query_vars[‘name’] = $this->query_vars[ $wpvar ]; } } } // Convert urldecoded spaces back into ‘+’. foreach ( get_taxonomies( array(), ‘objects’ ) as $taxonomy => $t ) { if ( $t->query_var && isset( $this->query_vars[ $t->query_var ] ) ) { $this->query_vars[ $t->query_var ] = str_replace( ‘ ‘, ‘+’, $this->query_vars[ $t->query_var ] ); } } // Don’t allow non-publicly queryable taxonomies to be queried from the front end. if ( ! is_admin() ) { foreach ( get_taxonomies( array( ‘publicly_queryable’ => false ), ‘objects’ ) as $taxonomy => $t ) { /* * Disallow when set to the ‘taxonomy’ query var. * Non-publicly queryable taxonomies cannot register custom query vars. See register_taxonomy(). */ if ( isset( $this->query_vars[‘taxonomy’] ) && $taxonomy === $this->query_vars[‘taxonomy’] ) { unset( $this->query_vars[‘taxonomy’], $this->query_vars[‘term’] ); } } } // Limit publicly queried post_types to those that are ‘publicly_queryable’. if ( isset( $this->query_vars[‘post_type’] ) ) { $queryable_post_types = get_post_types( array( ‘publicly_queryable’ => true ) ); if ( ! is_array( $this->query_vars[‘post_type’] ) ) { if ( ! in_array( $this->query_vars[‘post_type’], $queryable_post_types, true ) ) { unset( $this->query_vars[‘post_type’] ); } } else { $this->query_vars[‘post_type’] = array_intersect( $this->query_vars[‘post_type’], $queryable_post_types ); } } // Resolve conflicts between posts with numeric slugs and date archive queries. $this->query_vars = wp_resolve_numeric_slug_conflicts( $this->query_vars ); foreach ( (array) $this->private_query_vars as $var ) { if ( isset( $this->extra_query_vars[ $var ] ) ) { $this->query_vars[ $var ] = $this->extra_query_vars[ $var ]; } } if ( isset( $error ) ) { $this->query_vars[‘error’] = $error; } /** * Filters the array of parsed query variables. * * @since 2.1.0 * * @param array $query_vars The array of requested query variables. */ $this->query_vars = apply_filters( ‘request’, $this->query_vars ); /** * Fires once all query variables for the current request have been parsed. * * @since 2.1.0 * * @param WP $wp Current WordPress environment instance (passed by reference). */ do_action_ref_array( ‘parse_request’, array( &$this ) ); return true; } /** * Sends additional HTTP headers for caching, content type, etc. * * Sets the Content-Type header. Sets the ‘error’ status (if passed) and optionally exits. * If showing a feed, it will also send Last-Modified, ETag, and 304 status if needed. * * @since 2.0.0 * @since 4.4.0
X-Pingbackheader is added conditionally for single posts that allow pings. * @since 6.1.0 Runs after posts have been queried. * * @global WP_Query $wp_query WordPress Query object. */ public function send_headers() { global $wp_query; $headers = array(); $status = null; $exit_required = false; $date_format = ‘D, d M Y H:i:s’; if ( is_user_logged_in() ) { $headers = array_merge( $headers, wp_get_nocache_headers() ); } elseif ( ! empty( $_GET[‘unapproved’] ) && ! empty( $_GET[‘moderation-hash’] ) ) { // Unmoderated comments are only visible for 10 minutes via the moderation hash. $expires = 10 * MINUTE_IN_SECONDS; $headers[‘Expires’] = gmdate( $date_format, time() + $expires ); $headers[‘Cache-Control’] = sprintf( ‘max-age=%d, must-revalidate’, $expires ); } if ( ! empty( $this->query_vars[‘error’] ) ) { $status = (int) $this->query_vars[‘error’]; if ( 404 === $status ) { if ( ! is_user_logged_in() ) { $headers = array_merge( $headers, wp_get_nocache_headers() ); } $headers[‘Content-Type’] = get_option( ‘html_type’ ) . ‘; charset=’ . get_option( ‘blog_charset’ ); } elseif ( in_array( $status, array( 403, 500, 502, 503 ), true ) ) { $exit_required = true; } } elseif ( empty( $this->query_vars[‘feed’] ) ) { $headers[‘Content-Type’] = get_option( ‘html_type’ ) . ‘; charset=’ . get_option( ‘blog_charset’ ); } else { // Set the correct content type for feeds. $type = $this->query_vars[‘feed’]; if ( ‘feed’ === $this->query_vars[‘feed’] ) { $type = get_default_feed(); } $headers[‘Content-Type’] = feed_content_type( $type ) . ‘; charset=’ . get_option( ‘blog_charset’ ); // We’re showing a feed, so WP is indeed the only thing that last changed. if ( ! empty( $this->query_vars[‘withcomments’] ) || str_contains( $this->query_vars[‘feed’], ‘comments-‘ ) || ( empty( $this->query_vars[‘withoutcomments’] ) && ( ! empty( $this->query_vars[‘p’] ) || ! empty( $this->query_vars[‘name’] ) || ! empty( $this->query_vars[‘page_id’] ) || ! empty( $this->query_vars[‘pagename’] ) || ! empty( $this->query_vars[‘attachment’] ) || ! empty( $this->query_vars[‘attachment_id’] ) ) ) ) { $wp_last_modified_post = mysql2date( $date_format, get_lastpostmodified( ‘GMT’ ), false ); $wp_last_modified_comment = mysql2date( $date_format, get_lastcommentmodified( ‘GMT’ ), false ); if ( strtotime( $wp_last_modified_post ) > strtotime( $wp_last_modified_comment ) ) { $wp_last_modified = $wp_last_modified_post; } else { $wp_last_modified = $wp_last_modified_comment; } } else { $wp_last_modified = mysql2date( $date_format, get_lastpostmodified( ‘GMT’ ), false ); } if ( ! $wp_last_modified ) { $wp_last_modified = gmdate( $date_format ); } $wp_last_modified .= ‘ GMT’; $wp_etag = ‘”‘ . md5( $wp_last_modified ) . ‘”‘; $headers[‘Last-Modified’] = $wp_last_modified; $headers[‘ETag’] = $wp_etag; // Support for conditional GET. if ( isset( $_SERVER[‘HTTP_IF_NONE_MATCH’] ) ) { $client_etag = wp_unslash( $_SERVER[‘HTTP_IF_NONE_MATCH’] ); } else { $client_etag = ”; } if ( isset( $_SERVER[‘HTTP_IF_MODIFIED_SINCE’] ) ) { $client_last_modified = trim( $_SERVER[‘HTTP_IF_MODIFIED_SINCE’] ); } else { $client_last_modified = ”; } // If string is empty, return 0. If not, attempt to parse into a timestamp. $client_modified_timestamp = $client_last_modified ? strtotime( $client_last_modified ) : 0; // Make a timestamp for our most recent modification. $wp_modified_timestamp = strtotime( $wp_last_modified ); if ( ( $client_last_modified && $client_etag ) ? ( ( $client_modified_timestamp >= $wp_modified_timestamp ) && ( $client_etag === $wp_etag ) ) : ( ( $client_modified_timestamp >= $wp_modified_timestamp ) || ( $client_etag === $wp_etag ) ) ) { $status = 304; $exit_required = true; } } if ( is_singular() ) { $post = isset( $wp_query->post ) ? $wp_query->post : null; // Only set X-Pingback for single posts that allow pings. if ( $post && pings_open( $post ) ) { $headers[‘X-Pingback’] = get_bloginfo( ‘pingback_url’, ‘display’ ); } } /** * Filters the HTTP headers before they’re sent to the browser. * * @since 2.8.0 * * @param string[] $headers Associative array of headers to be sent. * @param WP $wp Current WordPress environment instance. */ $headers = apply_filters( ‘wp_headers’, $headers, $this ); if ( ! empty( $status ) ) { status_header( $status ); } // If Last-Modified is set to false, it should not be sent (no-cache situation). if ( isset( $headers[‘Last-Modified’] ) && false === $headers[‘Last-Modified’] ) { unset( $headers[‘Last-Modified’] ); if ( ! headers_sent() ) { header_remove( ‘Last-Modified’ ); } } if ( ! headers_sent() ) { foreach ( (array) $headers as $name => $field_value ) { header( “{$name}: {$field_value}” ); } } if ( $exit_required ) { exit; } /** * Fires once the requested HTTP headers for caching, content type, etc. have been sent. * * @since 2.1.0 * * @param WP $wp Current WordPress environment instance (passed by reference). */ do_action_ref_array( ‘send_headers’, array( &$this ) ); } /** * Sets the query string property based off of the query variable property. * * The {@see ‘query_string’} filter is deprecated, but still works. Plugins should * use the {@see ‘request’} filter instead. * * @since 2.0.0 */ public function build_query_string() { $this->query_string = ”; foreach ( (array) array_keys( $this->query_vars ) as $wpvar ) { if ( ” !== $this->query_vars[ $wpvar ] ) { $this->query_string .= ( strlen( $this->query_string ) < 1 ) ? ” : ‘&’; if ( ! is_scalar( $this->query_vars[ $wpvar ] ) ) { // Discard non-scalars. continue; } $this->query_string .= $wpvar . ‘=’ . rawurlencode( $this->query_vars[ $wpvar ] ); } } if ( has_filter( ‘query_string’ ) ) { // Don’t bother filtering and parsing if no plugins are hooked in. /** * Filters the query string before parsing. * * @since 1.5.0 * @deprecated 2.1.0 Use {@see ‘query_vars’} or {@see ‘request’} filters instead. * * @param string $query_string The query string to modify. */ $this->query_string = apply_filters_deprecated( ‘query_string’, array( $this->query_string ), ‘2.1.0’, ‘query_vars, request’ ); parse_str( $this->query_string, $this->query_vars ); } } /** * Set up the WordPress Globals. * * The query_vars property will be extracted to the GLOBALS. So care should * be taken when naming global variables that might interfere with the * WordPress environment. * * @since 2.0.0 * * @global WP_Query $wp_query WordPress Query object. * @global string $query_string Query string for the loop. * @global array $posts The found posts. * @global WP_Post|null $post The current post, if available. * @global string $request The SQL statement for the request. * @global int $more Only set, if single page or post. * @global int $single If single page or post. Only set, if single page or post. * @global WP_User $authordata Only set, if author archive. */ public function register_globals() { global $wp_query; // Extract updated query vars back into global namespace. foreach ( (array) $wp_query->query_vars as $key => $value ) { $GLOBALS[ $key ] = $value; } $GLOBALS[‘query_string’] = $this->query_string; $GLOBALS[‘posts’] = & $wp_query->posts; $GLOBALS[‘post’] = isset( $wp_query->post ) ? $wp_query->post : null; $GLOBALS[‘request’] = $wp_query->request; if ( $wp_query->is_single() || $wp_query->is_page() ) { $GLOBALS[‘more’] = 1; $GLOBALS[‘single’] = 1; } if ( $wp_query->is_author() ) { $GLOBALS[‘authordata’] = get_userdata( get_queried_object_id() ); } } /** * Set up the current user. * * @since 2.0.0 */ public function init() { wp_get_current_user(); } /** * Set up the Loop based on the query variables. * * @since 2.0.0 * * @global WP_Query $wp_the_query WordPress Query object. */ public function query_posts() { global $wp_the_query; $this->build_query_string(); $wp_the_query->query( $this->query_vars ); } /** * Set the Headers for 404, if nothing is found for requested URL. * * Issue a 404 if a request doesn’t match any posts and doesn’t match any object * (e.g. an existing-but-empty category, tag, author) and a 404 was not already issued, * and if the request was not a search or the homepage. * * Otherwise, issue a 200. * * This sets headers after posts have been queried. handle_404() really means “handle status”. * By inspecting the result of querying posts, seemingly successful requests can be switched to * a 404 so that canonical redirection logic can kick in. * * @since 2.0.0 * * @global WP_Query $wp_query WordPress Query object. */ public function handle_404() { global $wp_query; /** * Filters whether to short-circuit default header status handling. * * Returning a non-false value from the filter will short-circuit the handling * and return early. * * @since 4.5.0 * * @param bool $preempt Whether to short-circuit default header status handling. Default false. * @param WP_Query $wp_query WordPress Query object. */ if ( false !== apply_filters( ‘pre_handle_404’, false, $wp_query ) ) { return; } // If we’ve already issued a 404, bail. if ( is_404() ) { return; } $set_404 = true; // Never 404 for the admin, robots, or favicon. if ( is_admin() || is_robots() || is_favicon() ) { $set_404 = false; // If posts were found, check for paged content. } elseif ( $wp_query->posts ) { $content_found = true; if ( is_singular() ) { $post = isset( $wp_query->post ) ? $wp_query->post : null; $next = ”; // Check for paged content that exceeds the max number of pages. if ( $post && ! empty( $this->query_vars[‘page’] ) ) { // Check if content is actually intended to be paged. if ( str_contains( $post->post_content, $next ) ) { $page = trim( $this->query_vars[‘page’], ‘/’ ); $content_found = (int) $page <= ( substr_count( $post->post_content, $next ) + 1 ); } else { $content_found = false; } } } // The posts page does not support the pagination. if ( $wp_query->is_posts_page && ! empty( $this->query_vars[‘page’] ) ) { $content_found = false; } if ( $content_found ) { $set_404 = false; } // We will 404 for paged queries, as no posts were found. } elseif ( ! is_paged() ) { $author = get_query_var( ‘author’ ); // Don’t 404 for authors without posts as long as they matched an author on this site. if ( is_author() && is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author ) // Don’t 404 for these queries if they matched an object. || ( is_tag() || is_category() || is_tax() || is_post_type_archive() ) && get_queried_object() // Don’t 404 for these queries either. || is_home() || is_search() || is_feed() ) { $set_404 = false; } } if ( $set_404 ) { // Guess it’s time to 404. $wp_query->set_404(); status_header( 404 ); nocache_headers(); } else { status_header( 200 ); } } /** * Sets up all of the variables required by the WordPress environment. * * The action {@see ‘wp’} has one parameter that references the WP object. It * allows for accessing the properties and methods to further manipulate the * object. * * @since 2.0.0 * * @param string|array $query_args Passed to parse_request(). */ public function main( $query_args = ” ) { $this->init(); $parsed = $this->parse_request( $query_args ); if ( $parsed ) { $this->query_posts(); $this->handle_404(); $this->register_globals(); } $this->send_headers(); /** * Fires once the WordPress environment has been set up. * * @since 2.1.0 * * @param WP $wp Current WordPress environment instance (passed by reference). */ do_action_ref_array( ‘wp’, array( &$this ) ); } }
-
Carissimi ho ancora bisogno di voi per un nuovo sito web.
Un gruppo di amici mi ha chiesto di dargli una mano ed io ho proposto WordPress.
Ho installato l’ultima versione in italiano 6.4.2. Il server su cui gira per il momento e’ un raspberry con distro Linux Debian (bullseye). Installazione di base a cui ho aggiunto: apache2 2.4.41, PHP 7.4.3, MariaDB 10.3.38.
La parte relativa alla bacheca funziona perfettamente. Ho gestito la rimozione di alcuni plugin che non mi servivano ho fatto l’update di quelli rimasti. Ho aggiunto il tema Tewenty-Seventeen insomma tutto bene ma quando vado a creare un articolo oppure una pagina ottengo sempre l’errore:
“Pubblica Avviso di errore Pubblicazione fallita. La risposta non è una risposta JSON valida.” Aggiungo che in alto a sinistra sotto a “sei pronto per pubblicare mi viene proposto il logo di WordPress con la frase (senza titolo)
Ho fatto alcune verifiche per esempio se cambio i permalink da nome-articolo a id numerico funziona ma se lo rimetto con il nome articolo mi ridà errore. In pratica ancora non sono ancora riuscito a capire qual’e’ il motivo di questo problema.
Nel log del server non vedo nulla.
Mi date una mano per favore ?
Grazie
Willy
-
Ciao a tutti
utilizzo da anni WordPress su hosting Aruba per gestire il mio sito (www.martellotta.it) che contiene praticamente solo gallerie di immagini.
Per moltissimo tempo non ho avuto nessun problema, nemmeno creando gallerie con decine o centinaia di file: aggiungevo un articolo, creavo una galleria, uploadavo tutti i file che volevo fossero contenuti (a volte anche centinaia), attendevo il caricamento, e infine pubblicavo.
Da qualche tempo ho un problema che non riesco a risolvere e che si sta rivelando parecchio fastidioso: quando lancio l’upload di più di 10-15 files durante il caricamento mi compare il messaggio “la risposta non è una risposta JSON valida” e mi rimangono nella galleria una serie di immagini non caricate, quindi devo annullare tutto, riprovare, eliminare le imamgini caricate a metà, ecc….
Ho provato tutte le soluzioni che ho trovato online: annullare il salvataggio automatico (che in tutti i modi che ho trovato non si è mai annullato….), rigenerare i permalink, inserire configurazioni varie nella wp-config e nel file function, più una serie di azioni di manutenzione “aruba”, tipo la correzione dei permessi, ma nulla da fare, il problema non si risolve….
L’unica cosa che posso fare è caricare le immagini 10-12 alla volta, ma ovviamente i tenpi di lavoro aumentano parecchio, e soprattutto non capisco come mai il problema si sia presentato da un giorno all’altro!
Qualcuno ha qualche suggerimento?
Grazie anticipate a tutti!
Ale
-
Salve,
ho un problema di aggiornamento che non riesco a risolvere.
Sto cercando di aggiornare una inztallazione multisito portando la versione 5.8.6 a 6.1.1 ….. Spero che possiate mettermi sulla buona strada
——————————-
Premetto che nel server ho altre installazioni e che ho appena portato a buon fine un’altro aggiornamento di un wirdpress multisito dalla 5.8 alla 6,1,1La versione del php è la 8.0
tutti i plugin del network sono aggiornati e (pensando a possibili conflitti) li ho disattivati
—————————————
Quando provo ad aggiornare, questo è il risultato:Download dell'aggiornamento da https://downloads.wordpress.org/release/it_IT/wordpress-6.1.1.zip… L'autenticità di wordpress-6.1.1.zip non può essere verificata dato che non è stata trovata alcuna firma. Estrazione dell’aggiornamento in corso… Verifica dei file estratti in corso… Preparazione all’installazione dell'ultima versione in corso… The update cannot be installed because your site is unable to copy some files. This is usually due to inconsistent file permissions.: wp-admin/options-reading.php, wp-admin/edit-tags.php, wp-admin/link-manager.php, wp-admin/options-writing.php, wp-admin/widgets-form-blocks.php, wp-admin/my-sites.php, wp-admin/async-upload.php, wp-admin/link.php, wp-admin/privacy.php, wp-admin/options-general.php, wp-admin/comment.php, wp-admin/theme-editor.php, wp-admin/admin-ajax.php, wp-admin/update.php, wp-admin/install.php, wp-admin/erase-personal-data.php, wp-admin/plugin-editor.php, wp-admin/nav-menus.php, wp-admin/customize.php, wp-admin/update-core.php, wp-admin/options-permalink.php, wp-admin/site-health-info.php, wp-admin/freedoms.php, wp-admin/user-new.php, wp-admin/menu-header.php, wp-admin/index.php, wp-admin/link-add.php, wp-admin/plugins.php, wp-admin/post.php, wp-admin/themes.php, wp-admin/edit-comments.php, wp-admin/term.php, wp-admin/media.php, wp-admin/revision.php, wp-admin/admin.php, wp-admin/upload.php, wp-admin/edit-form-advanced.php, wp-admin/options.php, wp-admin/privacy-policy-guide.php, wp-admin/tools.php, wp-admin/import.php, wp-admin/widgets.php, wp-admin/options-media.php, wp-admin/edit-link-form.php, wp-admin/about.php, wp-admin/admin-post.php, wp-admin/theme-install.php, wp-admin/options-discussion.php, wp-admin/install-helper.php, wp-admin/site-health.php, wp-admin/edit-form-comment.php, wp-admin/authorize-application.php, wp-admin/export.php, wp-admin/load-scripts.php, wp-admin/load-styles.php, wp-admin/export-personal-data.php, wp-admin/admin-header.php, wp-admin/options-privacy.php Installazione fallita.—————–
Ho controllato i permessi ma mi sembrano tutti a posto (del resto gli aggiornamenti hanno sempre funzionato da dieci anni)La pagina su cui ho bisogno di aiuto: [devi essere connesso per vedere il link]
-
Ho impostato il permalink con una sola categoria.
/%category%/%postname%/
Però ho spesso sottocategorie. E le spunto entrambe quando pubblico l’articolo.
Il problema è che WordPress mi fornisce due links per ogni articolo.
Quindi, se pubblico carbonara sotto la categoria primi piatti, sottocategoria pasta, avrò due links che compariranno in search console:
http://www.ricetteromane/primipiatti/carbonara
http://www.ricetteromane/primipiatti/pasta/carbonara
Pur spuntando entrambe le categorie quando faccio l’articolo, io vorrei che wordpress registrasse solo il primo link e non il secondo.
Ovviamente va conservata la spunta alla categoria pasta.
Spero di essere stato chiaro.Grazie mille.
La pagina su cui ho bisogno di aiuto: [devi essere connesso per vedere il link]
-
Avete appena aggiornato a WordPress 6.0! Ma cos’è successo? Si è rotto qualcosa? O forse avete solo qualche domanda da porre? Questa guida vi aiuterà a risolvere i problemi e le domande più comuni dopo il nuovo aggiornamento.
Se il vostro sito si è bloccato, niente panico!Prima di continuare, assicuratevi di aver aggiornato i plugin e i temi alle versioni più recenti, di aver cancellato la cache e i cookie del browser e di aver effettuato nuovamente l’accesso alla Bacheca del vostro sito WordPress.
Avete ancora problemi? Ok, continuate a leggere!
Questa discussione contiene i problemi noti con i plugin e i temi presenti nell’ultima versione. Vi consigliamo di leggere TUTTO il topic e di tornare a controllarlo nel futuro, perché verrà aggiornato.
Ricordate di rimanere calmi, oltre che essere pazienti e rispettosi. I volontari sono qui per cercare di aiutarvi, ma abbiamo bisogno anche del vostro aiuto. Tutte le normali regole del forum sono ancora valide. Ricordate che siete importanti quanto gli altri.
Se il vostro post non viene visualizzato subito, state tranquilli: con un volume di messaggi superiore al normale, molti di questi vengono segnalati come spam dal nostro tool antispam. Stiamo lavorando duramente per mantenere la coda libera, ma la pubblicazione di più messaggi ci rallenta, in quanto dobbiamo tornare indietro e controllare se avete già postato. Vi consigliamo di pubblicare una volta sola.
- Usate la maiuscola nei titoli e nel corpo dei post. Punteggiate le frasi in modo corretto e umano, ci aiuta a leggere.
- Utilizzate l’oggetto per la descrizione. “Tutti i permalink non funzionano da 5.0” è molto meglio di “Ehi! Aiutatemi presto! Questa versione è terribile!”.
- Descrivete chiaramente il problema. Spiegate cosa vedete, includete i messaggi di errore e riportate gli screenshot quando necessario. Anche il link al vostro sito è utile, se il problema è sul frontend,
- Siate pazienti. Sappiamo che è bruttissimo essere bloccati, ma inviare più volte un messaggio non vi aiuterà più velocemente.
- Non creare un proprio argomento a meno che non si utilizzi la stessa versione di WordPress sullo stesso server fisico ospitato dallo stesso host con gli stessi plugin, tema e configurazioni del postatore originale. Forse vi sembrerà strano, ma sarà più facile per noi aiutarvi in modo specifico se avete un vostro argomento.
- Contrassegnate il vostro argomento come risolto quando è stato risolto, così sapremo che non dovremo più cercarlo.
Ricordate che non siete soli.
Tenete presente che il fatto che non vi piaccia come sta evolvendo il design di WordPress non è un bug. Se non vi piace una funzionalità, non fate una serie di post per lamentarvene. Cercate di vedere se qualcuno l’ha già fatto e postate lì, oppure prendete in considerazione l’idea di unirvi prima al team preposto per dare un aiuto (ad esempio in Beta o anche in test tramite SVN). Quello che vedete oggi è il risultato di migliaia di ore di lavoro e di test e, a meno che qualcosa non sia completamente rotto, è altamente improbabile che venga cambiato.
Di nuovo, prima di pubblicare qualcosa:
Assicuratevi di aver letto l’intera discussione e l’articolo sulle nuove funzionalità della versione 6.0.
Andate alla pagina informativa della vostra installazione – example.com/wp-admin/about.php (oppure cliccate sul logo di WordPress nell’angolo in alto) – per scoprire le novità.
Avete ancora problemi dopo aver seguito i passaggi di risoluzione dei problemi indicati di seguito? Non esitate a porre la vostra domanda nel forum di supporto.
What’s New in 6.0?
Avete già letto la Guida pratica di WordPress 6.0?
Diamo il benvenuto a Arturo, WordPress 6.0.I proprietari e gli amministratori dei siti dovrebbero effettuare l’aggiornamento per trarre il massimo vantaggio dai numerosi miglioramenti in termini di stabilità, prestazioni e usabilità. I creatori di contenuti potranno usufruire di una serie di nuove funzionalità volte a migliorare l’esperienza di scrittura e progettazione su WordPress.
I miglioramenti per agevolare la scrittura sono numerosi, sia che si tratti di scrivere un nuovo articolo o di aggiungere elementi a una pagina esistente. Scoprite altri modi per semplificare il processo di creazione dei contenuti, tra cui:
-
<li style=”list-style-type: none”>
- Selezionare il testo in più blocchi e modificarlo in una sola volta.
- Digitare due parentesi aperte [[ per accedere rapidamente al menu dei collegamenti.
- Mantenere gli stili esistenti quando si trasformano alcuni blocchi da un tipo a un altro, ad esempio da un blocco Paragrafo a un blocco Codice.
- Create pulsanti personalizzati e ogni nuovo pulsante che inserirete manterrà automaticamente le personalizzazioni dello stile.
- Rendere i tag cloud e le icone social ancora più attraenti con impostazioni e controlli aggiornati e un nuovo stile di contorno per la tag cloud.
Cambio dello stile
- I temi a blocchi includono ora la possibilità di contenere più varianti di stile. Questo amplia ulteriormente il nuovo sistema di stili e consente di cambiare l’aspetto del sito all’interno di un unico tema. È possibile modificare sia le impostazioni disponibili, come lo stile dei caratteri, sia le opzioni, come la tavolozza dei colori predefinita. Cambiate l’aspetto del vostro sito con pochi click.
Scoprite di più sul vostro sito con WordPress 6.0!
WordPress è un software progettato per tutti, con particolare attenzione all’accessibilità, alle prestazioni, alla sicurezza e alla facilità d’uso. Il progetto ritiene che un ottimo software debba funzionare con una configurazione minima, in modo che possiate concentrarvi sulla condivisione della vostra storia, del vostro prodotto o dei vostri servizi. Il software WordPress di default è semplice e intuitivo, per cui è facile iniziare a lavorare. Offre anche potenti funzionalità per la crescita e il successo.
WordPress crede nella democratizzazione della pubblicazione e nelle libertà che derivano dall’open source. A sostegno di questa idea c’è un’ampia comunità di persone che collaborano e contribuiscono a questo progetto. La comunità di WordPress è accogliente e inclusiva. La passione dei nostri collaboratori guida il successo di WordPress che, a sua volta, vi aiuta a raggiungere i vostri obiettivi.
Risoluzione dei problemi:
Prima di inviare il messaggio, accertatevi di aver iniziato ad eseguire i suggerimenti per la risoluzione dei problemi descritti di seguito:- Eliminare tutti i plugin di caching in esecuzione, nonché le cache del server e/o del browser. Non solo il browser, ma anche qualsiasi cache op o cache della rete di contenuti, come Cloudflare. Questo risolverà molti strani problemi di JavaScript.
- Eliminare le cache degli host gestiti. Gli hosting WP gestiti hanno spesso cache speciali. Se il vostro host ha uno strumento “Purge Varnish” o “Flush Memcache”, provatelo. Se necessario, potete chiedere al vostro provider di eliminare memcache e Varnish per voi.
- Salvate nuovamente le impostazioni dei Permalink. In alcuni casi, abbiamo visto installatori di terze parti, come Softaculous, creare siti con regole leggermente errate nel file .htaccess. Mentre queste regole non avrebbero costituito un problema nelle versioni precedenti, la presenza di queste regole errate può interrompere l’API REST nelle versioni più recenti. Il salvataggio dei permalink nella pagina Impostazioni->Permalink di WordPress correggerà queste regole nel file .htaccess e forse risolverà gli errori “non riusciti” nel nuovo editor.
- Risoluzione dei problemi con il browser. Il vostro browser può aiutarvi a identificare problemi o conflitti JavaScript e questo articolo può aiutarvi a fare questa diagnosi. Questo può aiutare a identificare anche i problemi dell’editor visuale.
- Assicuratevi di avere l’Editor visuale abilitato. Visitare la pagina Utenti->Profilo. La prima opzione disabilita l’editor visuale. Assicurarsi che l’opzione sia deselezionata e salvare le impostazioni del profilo.
- Disattivare tutti i plugin (confermato, tutti) per vedere se il problema si risolve. Se funziona, riattivare i plugin uno alla volta fino a trovare quello o quelli problematici. Se non è possibile accedere alla dashboard di amministrazione, provare a ripristinare la cartella dei plugin tramite SFTP/FTP o PhpMyAdmin (leggere “Come disattivare tutti i plugin quando non è possibile accedere a wp-admin” se si ha bisogno di aiuto). A volte, un plugin apparentemente inattivo può ancora causare problemi. Ricordate anche di disattivare tutti i plugin presenti nella cartella mu-plugins. Il modo più semplice è rinominare la cartella in mu-plugins-old.
- Se è possibile installare i plugin, installare “Health Check”: https://wordpress.org/plugins/health-check/. Nella scheda di risoluzione dei problemi, è possibile fare click sul pulsante per disattivare tutti i plugin e cambiare il tema, mentre si è ancora connessi, senza influenzare i normali visitatori del sito.
- Passare al tema Twenty Twenty One per escludere qualsiasi problema specifico del tema. Se non è possibile accedere per cambiare il tema, è possibile rimuovere le cartelle dei temi tramite SFTP/FTP, in modo che l’unica sia twentytwentyone. Questo costringerà il sito a utilizzarlo.
- Aggiornamento manuale. Se tutto il resto fallisce, scaricare una copia fresca del file latest.zip di questa versione (in alto a destra su questa pagina) sul computer e usarlo per eseguire la copia. Potrebbe essere necessario eliminare le cartelle wp-admin e wp-includes sul server (NOTA: non eliminare la cartella wp-content o il file wp-config.php). Leggete prima le istruzioni per l’aggiornamento manuale.
Se il problema persiste ed è legato a elementi che non funzionano più come previsto, ad esempio uno slider o un pulsante, è possibile che si verifichino problemi con la libreria JavaScript jQuery. Provate il plugin Enable jQuery Migrate Helper e vedete se questo risolve il problema.
Se è necessario creare un topic di supporto, è possibile fornire i dati di debug per i volontari del supporto visitando la sezione Salute del sito inTools > Site Health > Info.traduzione di @deadpool76
Problemi noti:
L’inserimento di un blocco classico utilizzando lo slash manda in crash l’editor se la barra laterale è aperta. vedi https://github.com/WordPress/gutenberg/issues/41321
Elementi già presenti nella lista per la versione 6.0.1
-
Buon giorno.
Ho un problema che non ho trovato sul Forum.
Ho trasferito il mio sito su un nuovo Hosting. Tutto all’apparenza è tornato normale, ma poi cercando di utilizzare il sito mi sono resa conto che è TUTTO bloccato.
Ad esempio:
– Non si caricano le immagini
– Se provo ad aprire la pagina “aggiungi nuovi plugin” dopo molto tempo arriva l’errore 404
– Se voglio inserire un Menu su “Personalizza” non si salva.
– Se provo a scrivere un nuovo articolo/pagina sotto “Articolo” esce la stringa:
Permalink: ?preview=true
Stai modificando la pagina che mostra i tuoi ultimi articoli.E non c’è, di fatto, lo spazio per scrivere l’articolo.
COSA HO GIA’ FATTO:
1) Sovrascritto i files del sito su public html del mio spazio hosting (wp_content, wp-admin e wp_includes) con file originali del sito WordPress tramite FileZilla (nel caso mancassero dei files necessari al funzionamento) e poi nuovamente ri-trasferiti quelli del backup del sito, in modo che i files pubblicati contengano tutte le info aggiornate necessarie per il mio sito;
2) Annullato il funzionamento di tutti i plugin rinominando la cartella plugin, in modo che risultassero tutti introvabili. L’errore persiste anche senza i plugin
3) Controllato i file wp_config e controllato che i dati corrispondessero. Tutto ok
4) Rinominato il file .htaccess per renderlo fuori uso, ma l’errore persiste.
5) Fatto ricreare da WordPress un file .htaccess in automatico andando su Impostazioni-Permalink- Salva (senza nessuna modifica) L’errore persiste.
6) Riscritto completamente il file .htaccess come consigliato da un webmaster nel web con i termini base e aggiunta di 3 stringhe per passaggio a HTTPS. Copiato codice completo, quindi non ci dovrebbero essere possibilità di errore.
7) Controllati permessi cartelle e files (755-644) e permessi .htaccess (644)
8) Ottimizzato, Analizzato e Riparato tabella Database su phpMyAdmin
9. Pregato/Imprecato Nessun risultato.
10. Ditemi voi cosa devo fare perché io ho esaurito la fantasia…
Grazie.
-
Buongiorno ,
Apro questo ticket in quanto in seguito a migrazione di un sito wordpress su altro hosting , non siamo piu riusciti ad utilizzarlo ed abbiamo inevitabilmente dovuto eseguire un rollback all’hosting precedente , nello specifico riuscivamo ad aprire solo la homepage del sito , ma non appena cliccavamo sulle varie sezioni veniva fuori l’errore che la pagina non esite o non è stata trovata , ho letto in giro nei vari forum che è dovuto ai permalink , cosa che pero’ ho provveduto ad aggiornare , ma niente da fare… il problema non si è risolto…
Avete qualche suggerimento?
Grazie.
Andrea
-
Buongiorno,
vi contatto per un problema che riscontro su un sito wordpress+woocommerce.
versione WP: non riesco a trovarla, sito costruito nel 2019
versione wc: 3.1.2DI recente è sta creata una pagina con permalink /shop-xxxx, abbiamo notato che se per sbaglio qualcuno digita l’indirizzo /shop (non corretto) viene comunque portato ad una pagina che non abbiamo creato no.
La pagina /shop si crea di default?Come posso fare per rimediare? Devo per forza rinominare la mia pagina in Shop?
Ho provato a modificare il link nelle impostazioni (permalink> permalink dei prodotti> base personalizzata) ma non cambia nulla.
Grazie per l’aiuto
-
Sto cercando, a scopo didattico, di sviluppare un custom post type e una custom taxonomy con permalink del tipo “…/nome_taxonomy/taxonomy/articolo”.
Si tratta di una sezione di un sito di recensioni, dove ho una prima pagina che mi mostra una specie di homepage (che non deve essere la homepage del sito), selezionando la categoria (taxonomy) entro nella categoria dei prodotti e selezionando l’articolo entro nella pagina dell’articolo stesso (CPT).
In parole povere, vorrei avere la seguente struttura:- “…com/attrezzatura/”: in questa pagina voglio avere una archive page con la lista di tutte le tassonomie (disponibili tramite menu in alto) e i contenuti rilevanti di tali tassonomie
- “.com/attrezzatura/cuffie/”: in questa pagina voglio la stessa identica pagina di prima, però filtrata con la taxonomy cuffie (o camere, o tastiere ecc), a cui si accede tramite il menu che rimane sempre e comunque in alto (come quello di apple, per intenderci)
- “.com/attrezzatura/cuffie/recensione-prodottoX/: in questa pagina voglio avere il prodotto, con la sua recensione e i vari link.
Per fare questo, ho creato un CPT chiamato recensioni e una tassonomia chiamata attrezzatura, per poi registrare il tutto in un plugin:
Codice CPT:
function cpt_recensioni(){ $labels = array( 'name' => __('Recensioni', 'fv-cpt'), 'singular_name' => __('Recensione', 'fv-cpt'), 'add_new' => __('Aggiungi Recensione', 'fv-cpt'), 'all_items' => __('Tutte le Recensioni', 'fv-cpt'), 'add_new_item' => __('Aggiungi Recensione', 'fv-cpt'), 'edit_item' => __('Modifica Recensione', 'fv-cpt'), 'new_item' => __('Nuova Recensione', 'fv-cpt'), 'view_item' => __('Vedi Recensione', 'fv-cpt'), 'search_item' => __('Cerca Recensione', 'fv-cpt'), 'not_found' => __('Recensione non trovata', 'fv-cpt'), 'not_found_in_trash' => __('Nessuna Recensione trovata nel cestino', 'fv-cpt'), ); $args = array( 'labels' => $labels, 'public' => true, 'has_archive' => true, 'publicly_queryable' => true, 'query_var' => true, 'rewrite' => true, 'capability_type' => 'post', 'hierarchical' => false, 'taxonomies' => array('attrezzatura'), 'rewrite' => array( 'slug' => 'attrezzatura/%taxonomy-name%', 'with-front' => true, ), 'support' => array( 'title', 'editor', 'thumbnail', 'revisions', 'custom-fields', ), 'menu_position' => 4, 'menu_icon' => 'dashicons-star-filled', 'exclude_from_search' => false, ); register_post_type('recensioni', $args); } add_action('init', 'cpt_recensioni');Codice tassonomia:
function tax_attrezzatura(){ $labels = array( 'name' => __('Categorie prodotti', 'fv-cpt'), 'singular_name' => __('Categoria prodotto', 'fv-cpt'), 'add_new_item' => __('Aggiungi Categoria prodotto', 'fv-cpt'), 'edit_item' => __('Modifica Categoria prodotto', 'fv-cpt'), 'new_item_name' => __('Nuova Categoria prodotto', 'fv-cpt'), 'all_items' => __('Tutte le Categorie prodotto', 'fv-cpt'), 'search_items' => __('Cerca Categoria Prodotto', 'fv-cpt'), 'update_item' => __('Aggiorna Categoria prodotto', 'fv-cpt'), ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'query_var' => true, 'show_ui' => true, 'show_admin_column' => true, 'rewrite' => array( 'slug' => 'attrezzatura', 'hierarchical' => true, 'with-front' => true, ), ); register_taxonomy('attrezzatura',array('recensioni'), $args); } add_action('init', 'tax_attrezzatura');Dopo numerose guide online, ho capito che per ottenere ciò che voglio dovrei avere, nel rewrite della tassonomia, lo slug “attrezzatura” e nello slug del CPT “attrezzatura/%taxonomy-name%”. Per modificare il %taxonomy-name% mi sono servito di questa funzione:
function filter_post_type_link($link, $post) { if ($post->post_type != 'recensioni') return $link; if ($cats = get_the_terms($post->ID, 'attrezzatura')) { $link = str_replace('%taxonomy-name%', $cats[0]->slug, $link); } return $link; } add_filter('post_type_link', 'filter_post_type_link', 10, 2);Ora, il permalink mi viene generato correttamente, ovvero per la recensione del prodotto X mi esce “/attrezzatura/cuffie/recensione-prodottoX/”, ma mi da un 404 nonostante io abbia creato il single-recensioni.php.
il link “/attrezzatura/cuffie” mi restituisce correttamente il file “taxonomy-attrezzatura.php”, mentre il link “/attrezzatura/” mi restituisce un 404, nonostante io abbia creato una pagina con tale slug nelle pagine classiche standard di wordpress.Una cosa strana, inoltre, è che per un solo articolo presente nel CPT mi viene generato correttamente il link, mentre per gli altri wordpress mi rimanda tramite redirect 301 alla homepage del sito; non riesco a capire da cosa dipende.
Qualcuno potrebbe aiutarmi a comprendere come generare correttamente un permalink del genere? Ho provato a cercare e ho riprovato tante volte, solo che non saprei con chi confrontarmi per capire il mio errore.
Avrei anche bisogno di capire quale file devo scrivere nella directory del tema per stilizzare ognuna di queste pagine, visto che single-recensioni.php non funziona e nemmeno creare una pagina con url “/attrezzatura” funziona.Ho visto che in molti dicono di usare il “rewrite rules array” e comunicare a wordpress come effettivamente interpretare i link. Ho provato con il seguente codice ma ogni volta che cerco di visitare un qualsiasi link citato sopra, ottengo lo stesso redirect 301 indesiderato alla homepage del sito (come quello di cui ho parlato per gli articoli).
add_filter('rewrite_rules_array', 'fv_rewrite_rules'); function fv_rewrite_rules($rules) { $newRules = array(); $newRules['attrezzatura/(.+)/?$'] = 'index.php?custom_post_type_name=$matches[1]'; $newRules['attrezzatura/?$'] = 'index.php?taxonomy_name=$matches[0]'; return array_merge($newRules, $rules); }Qualcuno in grado di spiegarmi come funziona? Non lo faccio di lavoro ma mi sono appassionato allo sviluppo da autodidatta, solo che per la prima volta il codex e i tutorial non mi sono serviti a comprendere dove sbaglio.
-
Buongiorno a tutti,
in un WordPress appena installato (5.7.1, nessun plugin isntallato, tema Twenty Twenty-One) ho fatto una prova collegando un articolo a 2 categorie diverse (non imparentate).
Ho notato che l’articolo risulta raggiungibile sia dall’indirizzo https://esempio.com/categoria1/ciao-mondo/ che da https://esempio.com/categoria2/ciao-mondo/.
E’ normale?
C’è un modo per rendere l’articolo raggiungibile soltanto dal permalink mostrato nel backoffice?
Questi url multipli creano diversi problemi dal punto di vista SEO…
-
Buongiorno a tutti, vi seguo da sempre ma è la prima volta che apro un post, perché non so più davvero cosa fare. Chiedo scusa in anticipo se ho sbagliato sezione, al momento mi sembra la più pertinente. Ma andiamo al dunque: ho un blog di cucina, con un tema carino ma molto semplice, acquistato su themeforest. Mi sono innamorata di un tema bellissimo che ho comprato di getto ma molto più strutturato, e molto serio e professionale. Ho aperto un sito di staging per poter fare tutte le prove e i vari test, e dopo una settimana che ci lavoro febbrilmente facendo anche nottate fino alle 5 (e andando a lavorare alle 8… cosa non si fa per un sito 🙂 ) il mio tema è pronto, e lo amo da morire, se non fosse per un piccolo (non tanto) problema dell’ultimo minuto di cui mi sono accorta solo adesso. Nel tema che ho attualmente scrivo i miei articoli (nella sezione ARTICOLI di WP) che una volta pubblicati escono con questo link, settato nelle impostazioni come permalink:
https://bluaragosta.it/2021/03/NOME_ARTICOLO.html
ho scelto questa impostazione di permalink perché vengo da blogger, che usava questo stile, e che ho sempre lasciato.
Il tema che VORREI usare adesso e che mi piace da impazzire ha un suo form dedicato per scrivere le ricette, sezione RECIPE, che permette l’interazione con i lettori e ha una serie infinita di informazioni, solo che scrivendo una ricetta dal form l’articolo viene pubblicato con questa forma:
https://bluaragosta.it/recipe/NOME_ARTICOLO
a questo punto mi sono venuti i brividi…. o faccio un redirect dei vecchi articoli, riscrivendoli tutti (non mi crea problemi, sono una fissata della forma e lo faccio anche) ma questo mi crea problemi serissimi che vanno OLTRE il mio sito: dovrei cambiare tutti i miei link in giro…twitter, facebook, pinterest, linkedin… nel mio blog ho 450 articoli, non saranno tantissimi ma andare a modificarli uno per uno sul mio blog ne ero consapevole e preparata, su ogni piattaforma no, dando per scontato di dimenticarmene qualcuno e quindi perdere faticosamente i miei lettori, fra l’altro ho più di 3000 lettori iscritti via mail, vuol dire che non vedranno più le ricette? O vedranno errori 404, 301 e via dicendo?
Pensavo che forse la cosa più semplice e meno faticosa sarebbe “costringere” il tema a mantenere il vecchio permalink, ma come posso fare? In pratica dopo tutto il mio discorso, scusate se sono stata prolissa ma era necessario per capire la situazione, c’è un modo (a livello di codici, plugin ecc) per mantenere i miei post futuri col vecchio sistema in modo da non sobbarcarmi una mole di lavoro infinita? Non solo i post futuri, ma anche quelli passati che riscriverò col nuovo form senza cambiare il permalink memorizzato dai miei lettori e non perdere anni di faticoso lavoro… li riscriverei adeguando la forma e modificando la data di pubblicazione in modo da rispettare la pubblicazione temporale (i post partono dal 2012)
Premetto che ho già chiesto al support del tema, la loro risposta è che “non fanno personalizzazioni, rivolgersi a uno sviluppatore”. Io abito in una piccola provincia, non so dove andare a recuperare uno sviluppatore, fossi a Milano o a un qualsiasi capoluogo di provincia sì, ma qui sono nel deserto dei tartari. Premetto che ho tutto aggiornato, uso i temi child, il tema è aggiornato, wordpress è aggiornato, faccio regolarmente i miei bravi backup e io sono disperata… riuscirò a cambiare questo benedetto tema? Il problema dei link al momento mi sembra insormontabile e mi viene voglia di buttare tutto alle ortiche, ma sono troppo testarda. Siete la mia ultima speranza….
Grazie ragazzi aspetto con ansia vostre risposte (e incrocio le dita)
Cristina
La pagina su cui ho bisogno di aiuto: [devi essere connesso per vedere il link]
-
Ciao a tutti,
sul mio blog riscontravo un problema nell’antemprima dei temi, con l’errore too many connections.
Dopo diverse prove scandagliando la rete ho rinominato la cartella plugin e magicamente tutto è tornato a funzionare.
Mi sono accorto poi che il colpevole è il plugin PERMALINK, che dovrebbe essere di default su wordpress.
Come posso risolvere il problema, considerando che ho già salvato le impostazioni come suggerito in diversi topic del web?
Grazie.
-