Updating post status via rest api

I am attempting to remove/hide a post via the REST API and having issues.

Currently, I have tried sending the payload as:

{
    'status':'private'
}

And I send the request to:

/wp/v2/posts/<id here>

Every other part of my requirements works. I am able to create a post and update post content, but now I want to remove a post without deleting it, but it doesn’t seem like I can update the status. I remembered reading that the payload needs to include title, content, and excerpt, so I tried another request with those and that didn’t work either.

I suppose I could fully delete the post if I need to, but this would work better for my needs. Does anyone know how to accomplish this or what I’m doing wrong?

seo – Should I change the AMP url? (when updating the url for the page itself?)

Let’s say I have a page under www.example.com/some/path, and its AMP version is under www.example.com/some/path/amp.

If I change the path of the page, let’s say to www.example.com/other/path, should I change the path of the AMP as well, for example to this: www.example.com/other/path/amp?

In other words, are there any disadvantages to have one fixed AMP url for a page, for all the page lifetime, without ever changing it, even the the page’s url (the canonical) is changing?

I’ve tried to search around the web and in google documentation, and all I have found is guidelines which say that I should have a redirect whenever the AMP url is changed (basically when moving from old site to new site which doesn’t supports the old url structure).
The point is that I don’t want to get to the situation when I even need the redirect, since I will always have the same AMP url.

Of course the amp page will have the updated page url as the canonical, and as I understand it, the SEO power is generated by the the url of the page and not the AMP version of the page.

So are there any advantages to update the url of the AMP as well?

magento2.3 – Magento 2.4.0 upgrade from Magento 2.3.5 not updating

when i upgrade to 2.4.0 from admin area. i get all green check mark, it goes through the next step, I skip the backup process. next step it goes through normal process after couple minutes into it, it shows success! but the magento version is still 2.3.5. not updating. any idea ?

dns – My website is down after updating to PremiumDns in namecheap

I bought PremiumDns from namecheap 10 hours ago and since then my website is down, down on all browsers. Is that normal, should I wait 48 hours to work? Also, I added 3 name servers of DigitalOcean to the customDNS but after I enabled the premiumDns, I can’t see the nameservers agaon. Is that the reason? if so,how to fix that, how to add the name servers to the PremiumDns?

   Thanks.

updating – update drupal core from a version to a new version with composer

i want to update the core from 8.7.6 to 8.9.2 and when I try this command “composer require drupal/core:^8.9.2 –update-with-dependencies” i have got an error like below , can anyone help me please to solve this and get the migration work

the error :

 Problem 1
    - webflo/drupal-core-require-dev 8.7.6 requires drupal/core 8.7.6 -> satisfiable by drupal/core(8.7.6) but these conflict with your requirements or minimum-stability.
    - webflo/drupal-core-require-dev 8.7.6 requires drupal/core 8.7.6 -> satisfiable by drupal/core(8.7.6) but these conflict with your requirements or minimum-stability.
    - webflo/drupal-core-require-dev 8.7.6 requires drupal/core 8.7.6 -> satisfiable by drupal/core(8.7.6) but these conflict with your requirements or minimum-stability.
    - Installation request for webflo/drupal-core-require-dev (locked at 8.7.6, required as ^8.7.0) -> satisfiable by webflo/drupal-core-require-dev(8.7.6).

my composer.json

{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 8 projects with composer",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "authors": (
        {
            "name": "",
            "role": ""
        }
    ),
    "repositories": (
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "package",
            "package": {
                "name": "harvesthq/chosen",
                "version": "1.8.7",
                "type": "drupal-library",
                "dist": {
                    "url": "https://github.com/harvesthq/chosen/releases/download/v1.8.7/chosen_v1.8.7.zip",
                    "type": "zip"
                },
                "require": {
                    "composer/installers": "^1.2.0"
                }
            }
        }
    ),
    "require": {
        "php": ">=5.6",
        "composer/installers": "^1.2",
        "cweagans/composer-patches": "^1.6.5",
        "drupal-composer/drupal-scaffold": "^2.5",
        "drupal/admin_toolbar": "^1.27",
        "drupal/bootstrap_barrio": "^4.22",
        "drupal/bootstrap_layouts": "^5.1",
        "drupal/bootstrap_sass": "^1.9",
        "drupal/chosen": "^2.8",
        "drupal/config_ignore": "^2.1",
        "drupal/config_split": "^1.4",
        "drupal/console": "^1.0.2",
        "drupal/core": "8.7.6",
        "drupal/devel": "^2.1",
        "drupal/ds": "^3.4",
        "drupal/eu_cookie_compliance": "^1.8",
        "drupal/google_analytics": "^3.0",
        "drupal/google_tag": "^1.2",
        "drupal/honeypot": "^1.29",
        "drupal/memcache": "^2.0",
        "drupal/menu_admin_per_menu": "^1.0",
        "drupal/menu_link_attributes": "^1.0",
        "drupal/module_filter": "^3.1",
        "drupal/pathauto": "^1.4",
        "drupal/redirect": "^1.4",
        "drupal/robotstxt": "^1.2",
        "drupal/simple_sitemap": "^3.3",
        "drupal/sitemap": "^1.5",
        "drupal/smtp": "^1.0@beta",
        "drupal/views_bootstrap": "^4.1",
        "drupal/yaml_editor": "^1.0",
        "drush/drush": "^9.0.0",
        "harvesthq/chosen": "^1.8",
        "vlucas/phpdotenv": "^2.4",
        "webflo/drupal-finder": "^1.0.0",
        "webmozart/path-util": "^2.3",
        "zaporylie/composer-drupal-optimizations": "^1.0"
    },
    "require-dev": {
        "webflo/drupal-core-require-dev": "^8.7.0"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true
    },
    "autoload": {
        "classmap": (
            "scripts/composer/ScriptHandler.php"
        ),
        "files": ("load.environment.php")
    },
    "scripts": {
        "pre-install-cmd": (
            "DrupalProject\composer\ScriptHandler::checkComposerVersion"
        ),
        "pre-update-cmd": (
            "DrupalProject\composer\ScriptHandler::checkComposerVersion"
        ),
        "post-install-cmd": (
            "DrupalProject\composer\ScriptHandler::createRequiredFiles"
        ),
        "post-update-cmd": (
            "DrupalProject\composer\ScriptHandler::createRequiredFiles"
        )
    },
    "extra": {
        "composer-exit-on-patch-failure": true,
        "patchLevel": {
            "drupal/core": "-p2"
        },
        "installer-paths": {
            "web/core": ("type:drupal-core"),
            "web/libraries/{$name}": ("type:drupal-library"),
            "web/modules/contrib/{$name}": ("type:drupal-module"),
            "web/modules/custom/{$name}": ("type:drupal-custom-module"),
            "web/profiles/contrib/{$name}": ("type:drupal-profile"),
            "web/profiles/custom/{$name}": ("type:drupal-custom-profile"),
            "web/themes/contrib/{$name}": ("type:drupal-theme"),
            "web/themes/custom/{$name}": ("type:drupal-custom-theme"),
            "drush/Commands/{$name}": ("type:drupal-drush")
        },
        "drupal-scaffold": {
            "initial": {
                ".editorconfig": "../.editorconfig",
                ".gitattributes": "../.gitattributes"
            }
        }
    }
}

ios – Swiftui View Not Updating When Published Variable is Vhanged

On a button press, I my app is trying to contact an api to receive data. This data is then stored in a published variable inside an observable object. For some reason, the view doesn’t populate with the data until the button that opens that view is press more than once. I am looking for the view to update with the information received from the api call on the first button press. The code I am referencing is provided below:

DataFetcher.swift:

class DataFetcher: ObservableObject{
    @Published var dataHasLoaded: Bool = false
    @Published var attendeesLoaded: Bool = false
    @Published var useresUventsLoaded: Bool = false
    @Published var profilesLoaded: Bool = false
    @Published var eventsUpdated: Bool = false
    @Published var events: (eventdata) = ()
    @Published var createdEvents: (eventdata) = ()
    @Published var profile: profiledata?
    @Published var atendees: (atendeedata) = ()
    @Published var IAmAtending: (atendeedata) = ()
    @Published var eventNames: (eventdata) = ()
    @Published var profileList: (profiledata) = ()
    @Published var token: String = UserDefaults.standard.string(forKey: "Token") ?? ""
    private var id: Int = 0

func fetchProfile(id: Int){
        
       // events.removeAll()
        profileUrl.append("/(id)")
        self.id = id
        let url = URL(string: profileUrl)!
        var request = URLRequest(url: url)
        
        if let range = profileUrl.range(of: "/(id)") {
           profileUrl.removeSubrange(range)
        }
        
        request.httpMethod = "GET"
        print(self.token)
        request.addValue("Token (self.token)", forHTTPHeaderField: "Authorization")
        let task = URLSession.shared.dataTask(with: request, completionHandler: parseFetchProfileObject)
                task.resume()
            }
            
            
            func parseFetchProfileObject(data: Data?, urlResponse: URLResponse?, error: Error?){
                guard error == nil else {
                    print("(error!)")
                    return
                }
                
                guard let content = data else{
                    print("No data")
                    return
                }
                
                if let decodedResponse = try? JSONDecoder().decode(profiledata?.self, from: content) {
                    DispatchQueue.main.async {
                        self.profile = decodedResponse
                        self.profileList.append(self.profile!)
                }
            }
            
        }
    
    
    
    func fetchAtendees(id: Int){
        
       // events.removeAll()
        atendeeUrl.append("/(id)")
        print(atendeeUrl)
       
        let url = URL(string: atendeeUrl)!
        var request = URLRequest(url: url)
       
        if let range = atendeeUrl.range(of:"/(id)") {
           atendeeUrl.removeSubrange(range)
        }
        
         request.httpMethod = "GET"
        print(self.token)
        request.addValue("Token (self.token)", forHTTPHeaderField: "Authorization")
        let task = URLSession.shared.dataTask(with: request, completionHandler: parseFetchAttendeesObject)
                task.resume()
            }

EventsUserCreatedView.swift

import Foundation
import SwiftUI
import Mapbox

struct EventsUserCreatedView: View {
    
    
    @Binding var token: String
    @State private var pressedEvent: Bool = false
    @State private var selectedEvent: Int = 0
    @State private var atendees: (atendeedata) = ()
    @State private var profileList: (profiledata) = ()
    @State private var showDeleteEventView: Bool = false
    var data: DataFetcher
    var mapStyle: URL
    
    
    var body: some View {
        ZStack{
            //NavigationView {
            
            
            
            if self.mapStyle == MGLStyle.darkStyleURL {
                List{
                    ForEach(self.data.createdEvents){ row in
                        HStack {
                            Button("((row.poi)!)") {
                                print("Display event information")
                                
                                self.selectedEvent = row.id
                                
                                self.pressedEvent = true
                                
                            }
                            
                            Spacer()
                            Button("Delete") {
                                
                                self.showDeleteEventView = true
                                print("Deletes the event in this row")
                            }.buttonStyle(BorderlessButtonStyle())
                                .padding(4)
                                .background(Color.red)
                                .cornerRadius(5)
                            
                        }.foregroundColor(Color.white)
                    }
                    
                }.background(Color.init(red: 0.05, green: 0.05, blue: 0.05))
                
                //if you hit more buttons than there is room for, it'll be scrollable. make some kind of for loop that iterates over events a user is going to and displays it
                
                //  }.navigationBarTitle("My Events")
                //   .navigationViewStyle(StackNavigationViewStyle())
                
                if pressedEvent{
                    Group{
                        if self.data.profilesLoaded == true{
                            //NavigationView {
                            List{
                                ForEach(self.data.profileList){ row in
                                    HStack {
                                        Text("(row.name)")
                                            .foregroundColor(Color.purple)
                                        Spacer()
                                    }
                                }
                            }.background(Color.init(red: 0.05, green: 0.05, blue: 0.05))
                            
                            //if you hit more buttons than there is room for, it'll be scrollable. make some kind of for loop that iterates over events a user is going to and displays it
                            
                            //}
                        } else{
                            Spacer()
                            Text("Loading Attendees")
                            Spacer()
                        }
                    }.onAppear{
                        //this can't be done on appear as it won't update when a different
                        self.data.profileList = ()
                        self.data.atendees = ()
                        DispatchQueue.main.async{
                            
                            self.data.fetchAtendees(id: self.selectedEvent)
                            
                            if self.data.profilesLoaded{
                                self.profileList = self.data.profileList
                                self.atendees = self.data.atendees
                            }
                        }
                    }
                    //.navigationBarTitle("My Attendees")
                    //.navigationViewStyle(StackNavigationViewStyle())
                }

NOTE: datafetcher (the observableobject) is passed to eventsusercreated view by the contentview

any help on how to up

Updating an old script to detect 404 errors

I used to run this script in my 404 page.
It was sending me an email with each 404 error. Sadly, it's not working any more, it's very old code. Can anyone help me to update it? Thanks in advance.

<?php
    $to = "email@domain.com";
# Gather visitor information
    $ip = getenv ("REMOTE_ADDR");                // IP Address
    $server_name = getenv ("SERVER_NAME");       // Server Name
    $request_uri = getenv ("REQUEST_URI");       // Requested URI
    $http_ref = getenv...
Code (markup):

Updating an old script to detect 404 errors

Magento 1: Discount Issue, Problem, Not Refreshing, Not Updating, Price Removing etc

If someone facing any problem regarding discount issue any type of so please contact me I have a customize solution for this 100% tested and working goo

grub – CentOS 8.2 does not boot after updating in 1 Aug 2020

I updated my CentOS 8.2 yesterday (yum update), everything was good until a rebooted my system, there was no boot loader! the system get stuck in a black window without showing anything at all.indeed the problem is grub. I tried to re-config my grub (grub2-mkconfig) by using CentOS 8.2 rescue mode (booted by the DVD ISO), nothing happened.

information:

  • my system is EFI (not legacy BIOS)
  • in the update process both grub and kernel updated as I remember

plugins – Multi-step, live updating search

I’m creating a website and want to set up a multi-step (live) filter for searching companies, industries etc and now I’m starting to explain…

I have 3 categories. First category has 5 criterias. When you choose one of them (it should be possible to choose ONLY one in the first stage) there are more criterias on the first sub-category and when you choose one criteria from the first sub-category (also should be possible to choose ONLY one) there comes the second sub-category where you can choose more criterias. It would be the best if you get the results LIVE. I’m searching for days and still can’t find anything. Hope it’s understandable and someone can help me. Thanks