[카테고리:] 워드프레스

  • 워드프레스 siteurl 수정하기

    MariaDB [webhost2]> desc wp_options;
    +————–+———————+——+—–+———+—————-+
    | Field | Type | Null | Key | Default | Extra |
    +————–+———————+——+—–+———+—————-+
    | option_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
    | option_name | varchar(191) | NO | UNI | | |
    | option_value | longtext | NO | | NULL | |
    | autoload | varchar(20) | NO | MUL | yes | |
    +————–+———————+——+—–+———+—————-+
    4 rows in set (0.001 sec)

    MariaDB [webhost2]> select * from wp_options where option_name=’siteurl’;
    +———–+————-+—————————–+———-+
    | option_id | option_name | option_value | autoload |
    +———–+————-+—————————–+———-+
    | 2 | siteurl | https://www.webhost.co.kr/wp | on |
    +———–+————-+—————————–+———-+
    1 row in set (0.000 sec)

    MariaDB [webhost2]> update wp_options set option_value=’http://demo9.webhost.co.kr/wp’ where option_value=’https://www.webhost.co.kr/wp’;
    Query OK, 2 rows affected (0.002 sec)
    Rows matched: 2 Changed: 2 Warnings: 0

    MariaDB [webhost2]> flush privileges;
    Query OK, 0 rows affected (0.008 sec)

    MariaDB [webhost2]>

    워드프레스에 사이트주소가 잘못된 경우 접속이 안됩니다.

    이때 mysql db에서 바로 수정하는 방법입니다.

    기록 : 2025-03-21

  • 워드프레스 변수명 확인하기

    <?php
    $current_user = wp_get_current_user();
    /**
    * @example Safe usage: $current_user = wp_get_current_user();
    * if ( !($current_user instanceof WP_User) )
    *     return;
    */
    echo ‘Username: ‘ . $current_user->user_login . ‘<br />’;
    echo ‘User email: ‘ . $current_user->user_email . ‘<br />’;
    echo ‘User first name: ‘ . $current_user->user_firstname . ‘<br />’;
    echo ‘User last name: ‘ . $current_user->user_lastname . ‘<br />’;
    echo ‘User display name: ‘ . $current_user->display_name . ‘<br />’;
    echo ‘User ID: ‘ . $current_user->ID . ‘<br />’;
    ?>

    위와 같이 하면 변수명을 확인할 수 있다.

    출처 : https://codex.wordpress.org/ko:%ED%95%A8%EC%88%98_%EB%A0%88%ED%8D%BC%EB%9F%B0%EC%8A%A4/wp_get_current_user#.EB.A6.AC.ED.84.B4_.EA.B0.92

    작성일자 : 2017.09.30