Restore contents of deleted user

None that don’t involve a backup. If you have a backup, you’ll have to do some work to restore only a certain user’s data without resetting everything to that point. I’d say import the backup into an empty database, then copy data over either with SQL (INSERT INTO wp_posts SELECT FROM otherdb.wp_posts WHERE post_author = … Read more

Get page id by title?

There is a function exactly for that: get_page_by_title( $page_title, $output = OBJECT, $post_type=”page” ); You can use it like this: $page = get_page_by_title( ‘Start’ ); To get the page from a specific post type: $custom = get_page_by_title( ‘Start’, OBJECT, ‘your_custom_post_type’ ); $post = get_page_by_title( ‘Start’, OBJECT, ‘post’ ); Be aware, this function will search in … Read more

How to redirect on particular page in wordpress? [closed]

You should get ID of the page you’re looking for: $page = get_page_by_title(‘thank-you’); wp_redirect(get_permalink($page->ID)); exit; It looks like you want to get page by slug. If that’s the case, you should use this function instead. Also, for Location header don’t use space after “Location” string: header(“Location: http://localhost/mysite/faq”);

How can I see a list of pages and post where my custom Gutenberg block is used?

General block name search One can e.g. use the general search in the /wp-admin backend to find some text within the post’s content that stores the blocks: We can search for a prefixed block name wp:my-plugin/my-block within the posts: example.com/wp-admin/edit.php ?s=wp:my-plugin%2Fmy-block%20&post_type=post where we have an extra space (url encoded as %20and / as %2F) after … Read more

Get Permalink for the top level parent of child pages

Here’s a way to get the top page url: $top_page_url = get_permalink( array_slice( get_ancestors( get_the_ID(), ‘page’ ) , -1 ) ); where get_ancestors() returns an array containing all the parents (ID) of the given page. You can read more about it in the Codex here. Here are various ways to get the last array item, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)